private static void Main() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); if (Args.Current.ContainsKey("Interactive")) { AppServiceThread.Start(); AppServiceTray.Show(); Application.Run(); } else if (Args.Current.ContainsKey("Install")) { ManagedInstallerClass.InstallHelper(new string[] { Assembly.GetExecutingAssembly().Location }); } else if (Args.Current.ContainsKey("Uninstall")) { ManagedInstallerClass.InstallHelper(new string[] { "/u", Assembly.GetExecutingAssembly().Location }); } else { ServiceBase.Run(new ServiceBase[] { AppService.Instance }); } }
protected override void OnStop() { AppServiceThread.Stop(); }
protected override void OnStart(string[] args) { AppServiceThread.Start(); }
private static void mnuExit_Click(object sender, EventArgs e) { AppServiceThread.Stop(); TrayIcon.Visible = false; Application.Exit(); }