Exemplo n.º 1
0
        protected void FireStatusChangeEvent(MonitorStatus status)
        {
            if (MonitorStatusChange != null)
            {
                var args = new MonitorStatusChangeEventArgs(status);

                if (MonitorStatusChange.Target is Control targetCtrl)
                {
                    targetCtrl.Invoke(MonitorStatusChange, this, args);
                }
                else
                {
                    MonitorStatusChange(this, args);
                }
            }
        }
Exemplo n.º 2
0
 private void OnMonitorStatusChange(object sender, MonitorStatusChangeEventArgs e)
 {
     if (e.Status == MonitorStatus.Monitoring)
     {
         toolStripStatusLabel.Text      = "Monitoring";
         toolStripStatusLabel.ForeColor = Color.Blue;
         startToolStripMenuItem.Enabled = false;
         stopToolStripMenuItem.Enabled  = true;
     }
     else
     {
         toolStripStatusLabel.Text      = "Not Monitoring";
         toolStripStatusLabel.ForeColor = Color.Red;
         startToolStripMenuItem.Enabled = true;
         stopToolStripMenuItem.Enabled  = false;
     }
 }