/// <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 async override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif await AppsJumpListManager.Current.UpdateList((await AppsManager.GetCurrent()).GetApps()); Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) // First activation { rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Window.Current.Content = rootFrame; if (rootFrame.Content == null) { NavigateTo(e.TileId, e.Arguments, rootFrame); } Window.Current.Activate(); this.dispatchers.Add(CoreWindow.GetForCurrentThread().Dispatcher); } else // Subsequent activations - create new view/UI thread { var view = CoreApplication.CreateNewView(); int windowId = 0; await view.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { windowId = ApplicationView.GetApplicationViewIdForWindow(CoreWindow.GetForCurrentThread()); var frame = new Frame(); NavigateTo(e.TileId, e.Arguments, frame); Window.Current.Content = frame; Window.Current.Activate(); ApplicationView.GetForCurrentView().Consolidated += View_Consolidated; }); // Run this on the last dispatcher so the windows get positioned correctly bool viewShown; await this.dispatchers.Last().RunAsync(CoreDispatcherPriority.Normal, async() => { viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(windowId); }); this.dispatchers.Add(view.Dispatcher); } }
private async void saveAppBarButton_Click(object sender, RoutedEventArgs e) { await(await AppsManager.GetCurrent()).AddEditApp(Model); Frame.Navigate(typeof(AppsFrame)); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); _app = (await AppsManager.GetCurrent()).GetApp((string)e.Parameter); }
private async void RemoveAppCommandHandler(string appId) { (await AppsManager.GetCurrent()).RemoveApp(appId); }
private async void Page_Loaded(object sender, RoutedEventArgs e) { appsGrid.ItemsSource = (await AppsManager.GetCurrent()).GetApps(); }