/// <summary> /// Handles the FileOk event of the openFileDialog control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="CancelEventArgs" /> instance containing the event data.</param> private void openFileDialog_FileOk(object sender, CancelEventArgs e) { FileTracker.ActiveFile = new FileInfo(openFileDialog.FileName); richTextBox.Text = FileTracker.OpenFile(FileTracker.ActiveFile); FileTracker.IsSaved = true; saveToolStripMenuItem.Enabled = false; updateFormText(); }
/// <summary> /// Initializes a new instance of the <see cref="Form1" /> class. /// </summary> /// <param name="args">The args.</param> public Form1(string[] args) { InitializeComponent(); if (args.Length > 0) { FileTracker.ActiveFile = new FileInfo(args[0]); var content = FileTracker.OpenFile(FileTracker.ActiveFile).Split(PARAM_SEPERATOR.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); richTextBox.Text = content[0]; if (content.Length > 1) { richTextBox1.Text = content[1].Trim(); } FileTracker.IsSaved = true; saveToolStripMenuItem.Enabled = false; updateFormText(); } updateFormText(); }