public static void OnChangeState(CheckerProfileEventArgs e)
        {
            // Make a temporary copy of the event to avoid possibility of
            // a race condition if the last subscriber unsubscribes
            // immediately after the null check and before the event is raised.
            EventHandler<CheckerProfileEventArgs> handler = ChangeState;

            // Event will be null if there are no subscribers
            if (handler != null)
            {
                // Format the string to send inside the CustomEventArgs parameter

                // Use the () operator to raise the event.
                handler(UpdateTimer,e);
            }
        }
 private void TimerEvent(Object myObject,
     CheckerProfileEventArgs e)
 {
     if (!this.IsDisposed)
     {
         if (e.IsChecerRunning)
         {
             trayContextMenu.Items["StartMenuItem"].Enabled = false;
             trayContextMenu.Items["StopMenuItem"].Enabled = true;
             runButton.Click -= button1_Click_1;
             runButton.Click += button1_Click_2;
             runButton.Text = "Стоп";
             runButton.BackColor = Color.Red;
             checkerTray.BalloonTipText = "Наблюдатель активен";
             checkerTray.Text = "Наблюдатель активен";
             checkerTray.ShowBalloonTip(10);
         }
         else
         {
             trayContextMenu.Items["StartMenuItem"].Enabled = true;
             trayContextMenu.Items["StopMenuItem"].Enabled = false;
             runButton.Click -= button1_Click_2;
             runButton.Click += button1_Click_1;
             runButton.Text = "Старт";
             runButton.BackColor = Color.LightGreen;
             checkerTray.BalloonTipText = "Наблюдатель не активен";
             checkerTray.Text = "Наблюдатель не активен";
             checkerTray.ShowBalloonTip(10);
         }
     }
 }
 private static void TimerEvent(Object myObject,
     CheckerProfileEventArgs e)
 {
     if (e.IsChecerRunning)
         {
             trayMenu.Items["StartMenuItem"].Enabled = false;
             trayMenu.Items["StopMenuItem"].Enabled = true;
             checkerTray.BalloonTipText = "Наблюдатель активен";
             checkerTray.Text = "Наблюдатель активен";
             checkerTray.ShowBalloonTip(10);
         }
         else
         {
             trayMenu.Items["StartMenuItem"].Enabled = true;
             trayMenu.Items["StopMenuItem"].Enabled = false;
             checkerTray.BalloonTipText = "Наблюдатель не активен";
             checkerTray.Text = "Наблюдатель не активен";
             checkerTray.ShowBalloonTip(10);
         }
 }