Beispiel #1
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location;

            Globals.Initialize(exePath);

            if (Environment.UserInteractive)
            {
                string             Title       = "IPMonitor " + IPMonitorGlobals.Version + " Service Manager";
                string             ServiceName = "IPMonitor";
                ButtonDefinition[] buttons     = new ButtonDefinition[]
                { new ButtonDefinition("Start Debug Mode", DebugMode_OnClick) };
                if (args.Length == 1 && args[0] == "debug")
                {
                    DebugMode_OnClick(null, null);
                }

                try
                {
                    Application.Run(new ServiceManager(Title, ServiceName, buttons));
                }
                finally
                {
                    if (sw != null)
                    {
                        sw.Stop();
                    }
                }
            }
            else
            {
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                    new MainService()
                };
                ServiceBase.Run(ServicesToRun);
            }
        }
Beispiel #2
0
 protected override void OnStop()
 {
     wrapper.Stop();
 }