private async Task LaunchApplicationAsync(string page, object launchParam) { await ThemeSelectorService.SetRequestedThemeAsync(); NavigationService.Navigate(page, launchParam); Window.Current.Activate(); }
private async Task LaunchApplicationAsync(string page, object launchParam) { //{[{ await ThemeSelectorService.SetRequestedThemeAsync(); //}]} }
private async Task StartupAsync() { //{[{ await ThemeSelectorService.SetRequestedThemeAsync(); //}]} }
private async Task LaunchApplicationAsync(string page, object launchParam) { CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true; await ThemeSelectorService.SetRequestedThemeAsync(); NavigationService.Navigate(page, launchParam); Window.Current.Activate(); SystemNavigationManagerPreview.GetForCurrentView().CloseRequested += (s, e) => { NotificationManager.Current.IsEnabled = false; NotificationManager.Current.RemoveBreakFinishedToastNotificationSchedule(); NotificationManager.Current.RemovePomodoroFinishedToastNotificationSchedule(); }; NotificationManager.Current.RemoveBreakFinishedToastNotificationSchedule(); NotificationManager.Current.RemovePomodoroFinishedToastNotificationSchedule(); //var dialog = new Views.FirstRunDialog(); //await dialog.ShowAsync(); //await Container.Resolve<IWhatsNewDisplayService>().ShowIfAppropriateAsync(); await Container.Resolve <IFirstRunDisplayService>().ShowIfAppropriateAsync(); //Container.Resolve<ILiveTileService>().SampleUpdate(); //Container.Resolve<IToastNotificationsService>().ShowToastNotificationSample(); }
private async Task LaunchApplicationAsync(string page, object launchParam) { await ThemeSelectorService.SetRequestedThemeAsync(); NavigationService.Navigate(page, launchParam); Window.Current.Activate(); Container.Resolve <IToastNotificationsService>().ShowToastNotificationSample(); }
//^^ //{[{ public async Task RedirectLoginPageAsync() { var frame = new Frame(); NavigationService.Frame = frame; Window.Current.Content = frame; await ThemeSelectorService.SetRequestedThemeAsync(); NavigationService.Navigate <Views.LogInPage>(); }
private async Task LaunchApplicationAsync(string page, object launchParam) { await ThemeSelectorService.SetRequestedThemeAsync(); var rootFrame = Window.Current.Content as Frame; Container.RegisterInstance <IConnectedAnimationService>(new ConnectedAnimationService(rootFrame)); NavigationService.Navigate(page, launchParam); Window.Current.Activate(); }
//^^ //{[{ public async Task RedirectLoginPageAsync() { var frame = new Frame(); NavigationService.Frame = frame; Window.Current.Content = frame; await ThemeSelectorService.SetRequestedThemeAsync(); NavigationService.Navigate(typeof(LogInViewModel).FullName); }
private async Task LaunchApplicationAsync(string page, object launchParam) { await ThemeSelectorService.SetRequestedThemeAsync(); var menuNavigationService = Container.Resolve <IMenuNavigationService>(); menuNavigationService.UpdateView(page, launchParam); Window.Current.Activate(); await Container.Resolve <IFirstRunService>().RunIfAppropriateAsync(); await Task.CompletedTask; }
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 将在启动应用程序以打开特定文件等情况下使用。 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { if (Window.Current.Content is null) { Window.Current.Content = new Shell(); } if (e.PrelaunchActivated == false) { // 确保当前窗口处于活动状态 Window.Current.Activate(); ExtendAcrylicIntoTitleBar(); } LogService.ConfigLogger(); DataLoadService.LoadFromDataAsync(); await ThemeSelectorService.InitializeAsync().ConfigureAwait(false); await ThemeSelectorService.SetRequestedThemeAsync(); }
private async Task LaunchApplicationAsync(string page, object launchParam) { CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true; await DataService.CreateTheDatabaseAsync(); await DataService.RemoveFuturePeriodsAsync(); await ThemeSelectorService.SetRequestedThemeAsync(); NavigationService.Navigate(page, launchParam); Window.Current.Activate(); SystemNavigationManagerPreview.GetForCurrentView().CloseRequested += async(s, e) => { HasExited = true; var deferral = e.GetDeferral(); await DataService.RemoveFuturePeriodsAsync(); NotificationManager.Current.IsEnabled = false; NotificationManager.Current.RemoveBreakFinishedToastNotificationSchedule(); NotificationManager.Current.RemovePomodoroFinishedToastNotificationSchedule(); deferral.Complete(); }; NotificationManager.Current.RemoveBreakFinishedToastNotificationSchedule(); NotificationManager.Current.RemovePomodoroFinishedToastNotificationSchedule(); //var dialog = new Views.FirstRunDialog(); //await dialog.ShowAsync(); //await Container.Resolve<IWhatsNewDisplayService>().ShowIfAppropriateAsync(); await Container.Resolve <IFirstRunDisplayService>().ShowIfAppropriateAsync(); //Container.Resolve<ILiveTileService>().SampleUpdate(); //Container.Resolve<IToastNotificationsService>().ShowToastNotificationSample(); Analytics.TrackEvent(Windows.System.UserProfile.GlobalizationPreferences.HomeGeographicRegion); }
protected override void OnLaunched(LaunchActivatedEventArgs e) { ThemeSelectorService.SetRequestedThemeAsync(ElementTheme.Light); //utilizacao do chooser tema Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Xamarin.Forms.Forms.Init(e); // requires the `e` parameter if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); } }
private async void SetTheme() { await ThemeSelectorService.InitializeAsync().ConfigureAwait(true); await ThemeSelectorService.SetRequestedThemeAsync().ConfigureAwait(false); }
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 将在启动应用程序以打开特定文件等情况下使用。 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected async override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; // 不要在窗口已包含内容时重复应用程序初始化, // 只需确保窗口处于活动状态 if (rootFrame == null) { // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 从之前挂起的应用程序加载状态 } // 将框架放在当前窗口中 Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.ExtendViewIntoTitleBar = true; await DataService.CreateTheDatabaseAsync(); await DataService.RemoveFuturePeriodsAsync(); await ThemeSelectorService.InitializeAsync().ConfigureAwait(false); await ThemeSelectorService.SetRequestedThemeAsync(); await SettingsService.InitializeAsync(); // 当导航堆栈尚未还原时,导航到第一页, // 并通过将所需信息作为导航参数传入来配置 // 参数 rootFrame.Navigate(typeof(MainPage), e.Arguments); HandleClosed(); try { await NotificationManager.Current.RemoveBreakFinishedToastNotificationScheduleAsync(); await NotificationManager.Current.RemovePomodoroFinishedToastNotificationScheduleAsync(); } catch (Exception ex) { Microsoft.AppCenter.Crashes.Crashes.TrackError(ex); } var properties = new Dictionary<string, string> { { "Region", Windows.System.UserProfile.GlobalizationPreferences.HomeGeographicRegion}, }; Analytics.TrackEvent("Launched", properties); } // 确保当前窗口处于活动状态 Window.Current.Activate(); await Services.GetService<IFirstRunDisplayService>().ShowIfAppropriateAsync(); } }