diff options
| author | John T <[email protected]> | 2017-11-05 18:47:46 -0500 |
|---|---|---|
| committer | John T <[email protected]> | 2017-11-05 18:47:46 -0500 |
| commit | a10440a45c40652b13e883aec832a0c8ded685e8 (patch) | |
| tree | ab64311e47f8e59c7c46cd50c94bec424165ecc2 /ShiftOS.Main/ShiftOS/Apps/TextPad.cs | |
| parent | 019da5b9ebf67b758a31dd05c4b17de66fa682f2 (diff) | |
| download | shiftos-rewind-a10440a45c40652b13e883aec832a0c8ded685e8.tar.gz shiftos-rewind-a10440a45c40652b13e883aec832a0c8ded685e8.tar.bz2 shiftos-rewind-a10440a45c40652b13e883aec832a0c8ded685e8.zip | |
Added a half-complete ShiftFS and did some code cleanup
Diffstat (limited to 'ShiftOS.Main/ShiftOS/Apps/TextPad.cs')
| -rw-r--r-- | ShiftOS.Main/ShiftOS/Apps/TextPad.cs | 76 |
1 files changed, 29 insertions, 47 deletions
diff --git a/ShiftOS.Main/ShiftOS/Apps/TextPad.cs b/ShiftOS.Main/ShiftOS/Apps/TextPad.cs index 6c091df..e86b1be 100644 --- a/ShiftOS.Main/ShiftOS/Apps/TextPad.cs +++ b/ShiftOS.Main/ShiftOS/Apps/TextPad.cs @@ -1,54 +1,36 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; using System.IO; -using ShiftOS.Engine; +using System.Windows.Forms; namespace ShiftOS.Main.ShiftOS.Apps { - public partial class TextPad : UserControl - { - string editedText; - public TextPad() - { - InitializeComponent(); - editedText = textBox.Text; - } - private bool isEdited(string editedString) - { - editedString = editedText; - if(editedString != textBox.Text) - { - return true; - } - else - { - return false; - } - } + public partial class TextPad : UserControl + { + readonly string _editedText; + + public TextPad() + { + InitializeComponent(); + _editedText = textBox.Text; + } + + bool IsEdited() => _editedText != textBox.Text; - private void openToolStripMenuItem_Click(object sender, EventArgs e) - { - if (openFileDialog1.ShowDialog() == DialogResult.OK) - { - var sr = new StreamReader(openFileDialog1.FileName); - textBox.Text = sr.ReadToEnd(); - sr.Close(); - } - } + void openToolStripMenuItem_Click(object sender, EventArgs e) + { + if (openFileDialog1.ShowDialog() != DialogResult.OK) return; + + var sr = new StreamReader(openFileDialog1.FileName); + textBox.Text = sr.ReadToEnd(); + sr.Close(); + } - private void newToolStripMenuItem_Click(object sender, EventArgs e) - { - if (isEdited(textBox.Text)) - { - MessageBox.Show("yay it works"); - } - } - } -} + void newToolStripMenuItem_Click(object sender, EventArgs e) + { + if (IsEdited()) + { + MessageBox.Show("yay it works"); + } + } + } +}
\ No newline at end of file |
