示例#1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            App.AppSettings = ApplicationSettings.Load();
            this.SwitchTheme(App.AppSettings.ColorScheme, App.AppSettings.BackgroundColor, App.AppSettings.FullThemeName);

            LocalizationHandler.SetCurrentLanguage(App.AppSettings.Language);

            DesktopServicesHandler desktopServicesHandler = new DesktopServicesHandler();

            desktopServicesHandler.Initialize();

            Logger.Initialize(desktopServicesHandler.FileService);
            DispatcherHelper.RegisterDispatcher(async(func) =>
            {
                await this.Dispatcher.Invoke(async() =>
                {
                    await func();
                });
            });
            SerializerHelper.Initialize(desktopServicesHandler.FileService);
            DialogHelper.Initialize(new WPFDialogShower());

            Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException       += CurrentDomain_UnhandledException;

            ChannelSession.Initialize(desktopServicesHandler);

            Logger.Log("Application Version: " + ChannelSession.Services.FileService.GetApplicationVersion());

            base.OnStartup(e);
        }
示例#2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            App.AppSettings = ApplicationSettings.Load();
            this.SwitchTheme(App.AppSettings.ColorScheme, App.AppSettings.BackgroundColor, App.AppSettings.FullThemeName);

            LocalizationHandler.SetCurrentLanguage(App.AppSettings.Language);

            DesktopServicesHandler desktopServicesHandler = new DesktopServicesHandler();

            desktopServicesHandler.Initialize();

            Logger.Initialize(desktopServicesHandler.FileService);
            SerializerHelper.Initialize(desktopServicesHandler.FileService);
            DialogHelper.Initialize(new WPFDialogShower());

            Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException       += CurrentDomain_UnhandledException;

            ChannelSession.Initialize(desktopServicesHandler);

            Logger.Log("Application Version: " + ChannelSession.Services.FileService.GetApplicationVersion());

            base.OnStartup(e);

            // Create mutex
            _mutex = new Mutex(true, "{" + Guid + "}");
            var mutexIsAquired = _mutex.WaitOne(TimeSpan.Zero, true);

            // Release mutex
            if (mutexIsAquired)
            {
                _mutex.ReleaseMutex();
            }
        }
示例#3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            App.AppSettings = ApplicationSettings.Load();
            this.SwitchTheme(App.AppSettings.ColorScheme, App.AppSettings.ThemeName, App.AppSettings.IsDarkColoring);

            LocalizationHandler.SetCurrentLanguage(App.AppSettings.Language);

            DesktopServicesHandler desktopServicesHandler = new DesktopServicesHandler();

            desktopServicesHandler.Initialize();

            Logger.Initialize(desktopServicesHandler.FileService);
            SerializerHelper.Initialize(desktopServicesHandler.FileService);

            Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException       += CurrentDomain_UnhandledException;

            ChannelSession.Initialize(desktopServicesHandler);

            Logger.Log("Application Version: " + ChannelSession.Services.FileService.GetApplicationVersion());

            base.OnStartup(e);
        }