internal ExternalControlServer() { m_Communication = new BroadcastCommunication(); //чтобы SystemHost мог говорить UI о том, что процесс синхронизации баз данных как-то завершился - сообщаем ему значение m_Communication SystemHost.SetCommunication(m_Communication); _IoMain = new LogicContainer(m_Communication); }
private static void Main() { Mutex mutex = null; var mutexCreated = false; for (var i = 0; i < 3; ++i) { mutex = new Mutex(true, @"Global\SCME.SERVICE.Mutex", out mutexCreated); if (mutexCreated) { break; } } if (!mutexCreated) { return; } using (mutex) { Application.ApplicationExit += ApplicationOnExit; Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += Application_ThreadException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; UIServiceConfig.Settings.LoadSettings(); var ico = Resources.ServiceIcon; ms_TrayIcon = new NotifyIcon { Text = @"SCME.Service", Icon = new Icon(ico, ico.Width, ico.Height), ContextMenu = new ContextMenu(new[] { new MenuItem(Resources.Program_Main_Exit, OnExitCommand) }), Visible = true }; if (SystemHost.Initialize()) { Application.Run(); } } }
private static void ApplicationOnExit(object Sender, EventArgs Args) { ms_TrayIcon.Visible = false; SystemHost.Close(); }