private async void ShowHamburgerMenuWindow() { hamburgerMenuFrameView = CoreApplication.CreateNewView(); ApplicationView.GetForCurrentView().Consolidated += HamburgerMenuDemoModule_Consolidated; int hamburgerMenuFrameViewId = 0; string description = ((DemoModuleViewModel)DataContext).DemoModule.About; string windowTitle = ((DemoModuleViewModel)DataContext).DemoModule.Title; await hamburgerMenuFrameView.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { ApplicationView.GetForCurrentView().Consolidated += DemoView_Consolidated; ApplicationView.GetForCurrentView().Title = windowTitle; var frame = new HamburgerMenuFrame(typeof(HamburgerMenuDemoModule_Menu)); var viewModel = new HamburgerMenuDemo_ViewModel() { Description = description, Title = windowTitle }; frame.DataContext = viewModel; ((ISupportServices)viewModel).ServiceContainer.RegisterService(new DispatcherService()); ((ISupportServices)viewModel).ServiceContainer.RegisterService(new CloseWindowService(CloseDemoView)); frame.Navigate(typeof(HamburgerMenuDemo_SettingsPage), null); Window.Current.Content = frame; Window.Current.Activate(); hamburgerMenuFrameViewId = ApplicationView.GetForCurrentView().Id; }); await ApplicationViewSwitcher.TryShowAsStandaloneAsync(hamburgerMenuFrameViewId); }
protected override async void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) { if (args.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Running) { Window.Current.Activate(); return; } viewModel = new MainViewModel(); DXFrame rootFrame = null; rootFrame = new HamburgerMenuFrame(typeof(HamburgerMenuPage)) { NavigationTypeProvider = new NavigationTypeProvider(), ViewModel = viewModel, DataContext = viewModel, UseLayoutRounding = true }; Interaction.GetBehaviors(rootFrame).Add(new DevExpress.Mvvm.UI.NavigationService() { Frame = rootFrame }); SuspensionManager.RegisterFrame(rootFrame, "AppFrame"); if (args.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated || args.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.ClosedByUser) { await SuspensionManager.RestoreAsync(); } if (rootFrame.Content == null) { if (!rootFrame.Navigate(typeof(MainPage), MainViewModel.MainScreenId)) { throw new Exception("Failed to create initial page"); } } Window.Current.Content = rootFrame; Window.Current.Activate(); Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SetPreferredMinSize(new Windows.Foundation.Size { Width = 500, Height = 500 }); #region DEMO_REMOVE #if DEBUGTEST DevExpress.TestFramework.TestApp.Start(args.Arguments + " -FullScreen:False"); this.UnhandledException -= App_UnhandledException; #endif #endregion }
/// <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) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif 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 HamburgerMenuFrame(typeof(HamburgerMenuPage)); rootFrame.NavigationFailed += OnNavigationFailed; 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(); } }