/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { var mainPage = Window.Current.Content as MainPage; if (mainPage == null) { mainPage = new MainPage(); IAccountProvider accountService = new LocalAcountProvider(); accountService.Initialize(); IShareProvider shareProvider = new ShareProvider(); shareProvider.Register(); IHistoryProvider historyProvider = new HistoryProvider(); historyProvider.Initialize(); SynchronizationContextProvider.Initialize(); mainPage.ViewModel = new MainViewModel(accountService, shareProvider, historyProvider); Window.Current.Content = mainPage; } Window.Current.Activate(); }
protected override void OnShown(EventArgs e) { base.OnShown(e); SynchronizationContextProvider.CreateSynchronizationContext(WindowsFormsSynchronizationContext.Current); }