Ejemplo n.º 1
0
        void FormMain_Load(object sender, EventArgs e)
        {
            //this.linkService.Text = (ServiceRunning.HasValue && ServiceRunning.Value) ? "Stop service" : "Start service";

            this.dataGridView1.AutoGenerateColumns = false;
            this.dataGridView1.CellDoubleClick    += new DataGridViewCellEventHandler(this.editButton_Click);

            if (File.Exists(UserLog.LogFile))
            {
                try
                {
                    base.Show();
                    this.ShowLog(UserLog.GetLogTail());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(string.Format("Couldn't read from {0}: {1}", UserLog.LogFile, ex.Message), "Log Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            this.logWatcher                     = new FileSystemWatcher(Path.GetDirectoryName(UserLog.LogFile), Path.GetFileName(UserLog.LogFile));
            this.logWatcher.Changed            += new FileSystemEventHandler(this.logWatcher_Changed);
            this.logWatcher.EnableRaisingEvents = true;

            this.UpdateRules();
        }
Ejemplo n.º 2
0
 private void logWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     this.ShowLog(UserLog.GetLogTail());
 }