protected override async void OnStartup(StartupEventArgs e) { WindowsServicesManager servicesManager = new WindowsServicesManager(); servicesManager.Initialize(); FileLoggerHandler.Initialize(servicesManager.FileService); DispatcherHelper.RegisterDispatcher(new WindowsDispatcher(this.Dispatcher)); DialogHelper.Initialize(new WPFDialogShower()); Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; await ChannelSession.Initialize(servicesManager); WindowsIdentity id = WindowsIdentity.GetCurrent(); ChannelSession.IsElevated = id.Owner != id.User; Logger.ForceLog(LogLevel.Information, "Application Version: " + ChannelSession.Services.FileService.GetApplicationVersion()); if (ChannelSession.IsDebug() || ChannelSession.AppSettings.DiagnosticLogging) { Logger.SetLogLevel(LogLevel.Debug); } else { Logger.SetLogLevel(LogLevel.Error); } this.SwitchTheme(ChannelSession.AppSettings.ColorScheme, ChannelSession.AppSettings.BackgroundColor, ChannelSession.AppSettings.FullThemeName); base.OnStartup(e); }
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); }
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(); } }
public App() { InitializeComponent(); MobileServicesHandler mobileServicesHandler = new MobileServicesHandler(); mobileServicesHandler.Initialize(); Logger.Initialize(mobileServicesHandler.FileService); SerializerHelper.Initialize(mobileServicesHandler.FileService); ChannelSession.Initialize(mobileServicesHandler); MainPage = new MixItUp.Mobile.MainPage(); }
public App() { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; try { // We need to load the language setting VERY early, so this is the minimal code necessary to get this value WindowsServicesManager servicesManager = new WindowsServicesManager(); servicesManager.Initialize(); ChannelSession.Initialize(servicesManager).Wait(); var selectedLanguageTask = ApplicationSettingsV2Model.Load(); selectedLanguageTask.Wait(); var culture = System.Threading.Thread.CurrentThread.CurrentCulture; if (LanguageMaps.TryGetValue(selectedLanguageTask.Result.LanguageOption, out string locale)) { culture = new System.Globalization.CultureInfo(locale); } System.Threading.Thread.CurrentThread.CurrentUICulture = culture; } catch { } }
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); }
protected override void OnStartup(StartupEventArgs e) { if (Settings.Default.DarkTheme) { this.SwitchTheme(isDark: true); } 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: " + Assembly.GetEntryAssembly().GetName().Version.ToString()); base.OnStartup(e); }