private static void StartAsApplication() { SystemHost.StartService(); var ico = Resources.ServiceIcon; ms_TrayIcon = new NotifyIcon { Text = @"SCME.NetworkPrinting", Icon = new Icon(ico, ico.Width, ico.Height), ContextMenu = new ContextMenu(new[] { new MenuItem(@"Exit", OnExit) }), Visible = true }; Application.ApplicationExit += Application_ApplicationExit; Application.Run(); }
protected override void OnStop() { base.OnStop(); SystemHost.StopService(); }
protected override void OnStart(string[] Args) { base.OnStart(Args); SystemHost.StartService(); }
private static void CurrentDomainUnhandledException(object Sender, UnhandledExceptionEventArgs E) { SystemHost.LogCriticalErrorMessage((Exception)E.ExceptionObject); }
static void Application_ApplicationExit(object Sender, EventArgs E) { SystemHost.StopService(); }