コード例 #1
0
 private async Task HandleActivationAsync()
 {
     if (App.Current.Windows.OfType <IShellWindow>().Count() == 0)
     {
         // Default activation that navigates to the apps default page
         _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow;
         _navigationService.Initialize(_shellWindow.GetNavigationFrame());
         _rightPaneService.Initialize(_shellWindow.GetRightPaneFrame(), _shellWindow.GetSplitView());
         _shellWindow.ShowWindow();
         _navigationService.NavigateTo(typeof(MainViewModel).FullName);
         await Task.CompletedTask;
     }
 }
        public async Task StartAsync()
        {
            // Initialize services that you need before app activation
            await InitializeAsync();

            _shellWindow = SimpleIoc.Default.GetInstance <IShellWindow>();
            _navigationService.Initialize(_shellWindow.GetNavigationFrame());
            _rightPaneService.Initialize(_shellWindow.GetRightPaneFrame(), _shellWindow.GetSplitView());
            _shellWindow.ShowWindow();
            _navigationService.NavigateTo(typeof(MainViewModel).FullName);

            // Tasks after activation
            await StartupAsync();
        }