Ejemplo n.º 1
0
        Launcher()
        {
            // warn-up
            var cache = Cache.Instance;

            setting   = Setting.Instance;
            servers   = Servers.Instance;
            configMgr = ConfigMgr.Instance;

            notifier    = Notifier.Instance;
            pluginsServ = PluginsServer.Instance;

            SetCulture(setting.culture);

            // dependency injection
            cache.Run(setting);
            servers.Run(setting, cache, configMgr);
            configMgr.Run(setting, cache, servers);
            notifier.Run(setting, servers);
            pluginsServ.Run(setting, servers, configMgr, notifier);

            Application.ApplicationExit +=
                (s, a) => OnApplicationExitHandler(false);

            Microsoft.Win32.SystemEvents.SessionEnding +=
                (s, a) => OnApplicationExitHandler(true);

            Application.ThreadException +=
                (s, a) => SaveExceptionAndExit(
                    a.Exception.ToString());

            AppDomain.CurrentDomain.UnhandledException +=
                (s, a) => SaveExceptionAndExit(
                    (a.ExceptionObject as Exception).ToString());
        }
Ejemplo n.º 2
0
        Launcher()
        {
            orgSysProxySetting = Lib.Sys.ProxySetter.GetProxySetting();
            // warn-up
            var cache = Cache.Instance;
            var cmder = Cmder.Instance;

            setting   = Setting.Instance;
            pacServer = PacServer.Instance;
            servers   = Servers.Instance;
            notifier  = Notifier.Instance;

            SetCulture(setting.culture);

            // dependency injection
            pacServer.Run(setting);
            servers.Run(setting, pacServer, cache);
            cmder.Run(setting, servers, pacServer);
            notifier.Run(setting, servers);

            Application.ApplicationExit +=
                (s, a) => OnApplicationExitHandler(false);

            Microsoft.Win32.SystemEvents.SessionEnding +=
                (s, a) => OnApplicationExitHandler(true);

            Application.ThreadException +=
                (s, a) => SaveExceptionAndExit(
                    a.Exception.ToString());

            AppDomain.CurrentDomain.UnhandledException +=
                (s, a) => SaveExceptionAndExit(
                    (a.ExceptionObject as Exception).ToString());
        }
Ejemplo n.º 3
0
        Launcher()
        {
            // warn-up
            var cache     = Cache.Instance;
            var pacServer = PacServer.Instance;

            setting  = Setting.Instance;
            servers  = Servers.Instance;
            notifier = Notifier.Instance;

            // set culture
            SetCulture(setting.culture);

            // dependency injection
            Lib.ImportParser.Run(cache);
            pacServer.Run(setting);
            servers.Run(setting, pacServer, cache);
            notifier.Run(setting, servers);

            Application.ApplicationExit += (s, a) =>
            {
                notifier.Cleanup();
                servers.Cleanup();
                pacServer.Cleanup();
                setting.Cleanup();
            };

            Microsoft.Win32.SystemEvents.SessionEnding +=
                (s, a) => Application.Exit();

            Application.ThreadException +=
                (s, a) => SaveUnHandledException(
                    a.Exception.ToString());

            AppDomain.CurrentDomain.UnhandledException +=
                (s, a) => SaveUnHandledException(
                    (a.ExceptionObject as Exception).ToString());
        }