aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Main/ShiftOS/Apps/TextPad.cs
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.Main/ShiftOS/Apps/TextPad.cs')
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/TextPad.cs76
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