示例#1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (file != null)
            {
                file.close();
                file = null;
                richTextBox1.Text = "";
            }
            dialog.Filter = "All Files|*.*";
            DialogResult results = dialog.ShowDialog();

            file = new HFile(dialog.FileName);
            scrollbar.Enabled         = true;
            fileSystemWatcher1.Path   = System.IO.Directory.GetParent(dialog.FileName).FullName;
            fileSystemWatcher1.Filter = dialog.SafeFileName;
            //contextMenuStrip1.Enabled = true;
            loadLines();
            if (dialog.SafeFileName.IndexOf(".") > -1)
            {
                updateWindowTitle(dialog.SafeFileName.Substring(0, dialog.SafeFileName.IndexOf(".")));
            }
            else
            {
                updateWindowTitle(dialog.SafeFileName);
            }
        }
示例#2
0
 private void fileSystemWatcher1_Changed(object sender, System.IO.FileSystemEventArgs e)
 {
     file.close();
     file = new HFile(e.FullPath);
     loadLines();
     if (this.WindowState == FormWindowState.Minimized)
     {
         this.Text = "(Changed) " + caption;
     }
 }