Beispiel #1
0
        public App()
        {
            AppDomain.CurrentDomain.ProcessExit += (o, e) => {
                Core.WarningHandler.Info("Lazurite отключен");
            };

            System.Windows.Forms.Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            System.Windows.Forms.Application.ThreadException += (o, e) => {
                HandleUnhandledException(e.Exception);
            };

            AppDomain.CurrentDomain.UnhandledException += (o, e) => {
                HandleUnhandledException(e.ExceptionObject as Exception);
            };

            DispatcherUnhandledException += (o, e) => {
                HandleUnhandledException(e.Exception);
            };

            ShutdownMode = ShutdownMode.OnExplicitShutdown;
            try
            {
                Core = new LazuriteCore();

                // Crutch; after this actions first window run is faster
                JournalLightWindow.Show("Lazurite запущен...", WarnType.Info);
                JournalLightWindow.CloseWindow();

                Core.WarningHandler.OnWrite += (o, e) => {
                    var args = (WarningEventArgs)e;
                    JournalManager.Set(args.Message, args.Value, args.Exception);
                };
                Core.Initialize();
                Core.Server.StartAsync(null);
                Singleton.Add(Core);
                NotifyIconManager.Initialize();
                DuplicatedProcessesListener.Found += (o, e) => NotifyIconManager.ShowMainWindow();
                DuplicatedProcessesListener.Start();
            }
            catch (Exception e)
            {
                Core.WarningHandler.Fatal("Во время инициализации приложения возникла ошибка", e);
            }

            var ci = new CultureInfo("ru-RU");

            Thread.CurrentThread.CurrentCulture   = ci;
            Thread.CurrentThread.CurrentUICulture = ci;
        }
Beispiel #2
0
 private void RightSideHoverForm_MouseEnter(object sender, EventArgs e) =>
 NotifyIconManager.ShowFastSwitchWindow();