Пример #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var dialog = new OpenFileDialog
            {
                CheckFileExists = true,
                CheckPathExists = true,
                DefaultExt = "log",
                Multiselect = false,
                ReadOnlyChecked = true,
                ShowHelp = false,
                Title = "Select the log file you want to view"
            })
            {
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                this.monitor?.Stop();

                this.toolStripStatusLabel.Text = "Monitoring " + dialog.FileName;

                this.monitor = new LogFileMonitor(dialog.FileName, this);
                this.monitor.OnLineAddition += this.LogChanged;
                this.monitor.Start();
            }
        }
Пример #2
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (var dialog = new OpenFileDialog
            {
                CheckFileExists = true,
                CheckPathExists = true,
                DefaultExt = "log",
                Multiselect = false,
                ReadOnlyChecked = true,
                ShowHelp = false,
                Title = "Select the log file you want to view"
            })
            {
                if (dialog.ShowDialog() != DialogResult.OK) return;

                this.monitor?.Stop();

                this.toolStripStatusLabel.Text = "Monitoring " + dialog.FileName;

                this.monitor = new LogFileMonitor(dialog.FileName, this);
                this.monitor.OnLineAddition += this.LogChanged;
                this.monitor.Start();
            }
        }