2017-11-05 20:13:06 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2017-11-05 23:47:46 +00:00
|
|
|
|
using System.Windows.Forms;
|
2017-11-05 20:13:06 +00:00
|
|
|
|
|
|
|
|
|
namespace ShiftOS.Main.ShiftOS.Apps
|
|
|
|
|
{
|
2017-11-05 23:47:46 +00:00
|
|
|
|
public partial class TextPad : UserControl
|
|
|
|
|
{
|
|
|
|
|
readonly string _editedText;
|
|
|
|
|
|
|
|
|
|
public TextPad()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_editedText = textBox.Text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool IsEdited() => _editedText != textBox.Text;
|
2017-11-05 20:13:06 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
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();
|
|
|
|
|
}
|
2017-11-05 20:13:06 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
void newToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (IsEdited())
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("yay it works");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|