WINDOWSSERVICEWRAPPER/Program.cs
/// <summary>
/// The delegated method to execute in conjunction with the timer. Simply refreshes the context
/// menu depending on the status of the service.
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
The delegated method to execute in conjunction with the timer. Simply refreshes the context
menu depending on the status of the service.
The delegated method to execute in conjunction with the timer . Simply refreshes the context menu depending on the status of the service .
private static void ServiceChecker(object source, System.Timers.ElapsedEventArgs e)
        {
            sc.Refresh();
            try
            {
                if (sc.Status == ServiceControllerStatus.Running)
                {
                    appIcon.Icon = WindowsServiceWrapper.Properties.Resources.ServiceStart;
                    appIcon.Text = "Service Monitor";
                }
                else if (sc.Status == ServiceControllerStatus.Stopped)
                {
                    appIcon.Icon = WindowsServiceWrapper.Properties.Resources.ServiceStop;
                    appIcon.Text = "Service Stopped !!!";
                }
                if (sc.Status != ServiceControllerStatus.Running)
                {
                    mnu.MenuItems["Start Compare Cloudware EMailer Service"].Enabled = true;
                    mnu.MenuItems["Stop Compare Cloudware EMailer Service"].Enabled = false;
                }
                else
                {
                    mnu.MenuItems["Start Compare Cloudware EMailer Service"].Enabled = false;
                    mnu.MenuItems["Stop Compare Cloudware EMailer Service"].Enabled = true;
                }
            }
            catch
            {
            }
        }
private static void ServiceChecker ( object source , System . Timers . ElapsedEventArgs e ) { sc . Refresh ( ) ; try { if ( sc . Status == ServiceControllerStatus . Running ) { appIcon . Icon = WindowsServiceWrapper . Properties . Resources . ServiceStart ; appIcon . Text = " " ; } else if ( sc . Status == ServiceControllerStatus . Stopped ) { appIcon . Icon = WindowsServiceWrapper . Properties . Resources . ServiceStop ; appIcon . Text = " " ; } if ( sc . Status != ServiceControllerStatus . Running ) { mnu . MenuItems [ " " ] . Enabled = true ; mnu . MenuItems [ " " ] . Enabled = false ; } else { mnu . MenuItems [ " " ] . Enabled = false ; mnu . MenuItems [ " " ] . Enabled = true ; } } catch { } }
The delegated method to execute in conjunction with the timer.
The delegated method to execute in conjunction with the timer .
//sc.Start();
source
object
None
e
System.Timers.ElapsedEventArgs
None