コード例 #1
0
        private async void SecondaryAppView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            Debug.WriteLine($"SecondaryAppView_Consolidated: IsAppInitiated:{args.IsAppInitiated} IsUserInitiated:{args.IsUserInitiated}");

            await PlaylistPlayer.ClearAsync();

            await SecondaryViewPlayerNavigationService.NavigateAsync(nameof(BlankPage), _BlankPageNavgationTransitionInfo);

            // Note: 1803時点での話
            // VisibleBoundsChanged がアプリ終了前に呼ばれるが
            // この際メインウィンドウとセカンダリウィンドウのウィンドウサイズが互い違いに送られてくるため
            // 直前のウィンドウサイズの値を前々回表示のウィンドウサイズ(_PrevSecondaryViewSize)で上書きする
            if (_PrevSecondaryViewSize != default(Size))
            {
                var localObjectStorageHelper = Microsoft.Toolkit.Mvvm.DependencyInjection.Ioc.Default.GetService <Microsoft.Toolkit.Uwp.Helpers.LocalObjectStorageHelper>();
                localObjectStorageHelper.Save(secondary_view_size, _PrevSecondaryViewSize);
            }

            _scheduler.Schedule(() =>
            {
                IsShowSecondaryView = false;
            });

            LastNavigatedPageName = null;

            // プレイヤーを閉じた時に再生中情報をクリア
            if (!isMainViewClosed)
            {
                Debug.WriteLine("ClearCurrentPlayerEntry secondary view closed.");
                _restoreNavigationManager.ClearCurrentPlayerEntry();
            }
        }
コード例 #2
0
 private void AppView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     appViewConsolidated = true;
     windowClosed        = true;
     TryCloseWindow();
     Dispose();
 }
コード例 #3
0
 private void ViewConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     ApplicationView.GetForCurrentView().Consolidated -= ViewConsolidated;
     mediaPlayer.MediaPlayer.Dispose();
     mediaPlayer = null;
     Window.Current.Close();
 }
コード例 #4
0
 void DemoView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     if (!CoreApplication.GetCurrentView().IsMain)
     {
         CloseDemoView();
     }
 }
コード例 #5
0
ファイル: LyricView.xaml.cs プロジェクト: zxw567/Aurora.Music
 private void LyricView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     ApplicationView.GetForCurrentView().Consolidated -= LyricView_Consolidated;
     PlaybackEngine.PlaybackEngine.Current.PositionUpdated -= LyricView_PositionUpdated;
     PlaybackEngine.PlaybackEngine.Current.ItemsChanged    -= LyricView_StatusChanged;
     MainPage.Current.LyricViewID = -1;
 }
コード例 #6
0
 private void View_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     if (Consolidated != null)
     {
         Consolidated(this, EventArgs.Empty);
     }
 }
コード例 #7
0
 static void Helper_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     sender.Consolidated -= Helper_Consolidated;
     if (!CoreApplication.GetCurrentView().IsMain)
     {
         Window.Current.Close();
     }
 }
コード例 #8
0
 private void MainPage_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     Debug.WriteLine($"{ApplicationView.GetForCurrentView().Id} was consolidated");
     if (!CoreApplication.GetCurrentView().IsMain)
     {
         CoreApplication.GetCurrentView().CoreWindow.Close();
     }
 }
コード例 #9
0
        private void OnConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            if (RootElement is Frame frame)
            {
                frame.Content = null;
            }

            Handled = false;
        }
コード例 #10
0
        private async void PreviewWindow_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine($"Consolidated: user initiated: {args.IsUserInitiated}");

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, delegate
            {
                OpenPaneButton.IsChecked = false;
            });
        }
コード例 #11
0
 private void OnConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs e)
 {
     TraceLogger.GetInstance().DecreaseWindowCount();
     if (m_parent.IsAlive)
     {
         var parent = m_parent.Target as App;
         parent.RemoveWindow(this);
     }
 }
コード例 #12
0
        private void View_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            var windowID = ApplicationView.GetApplicationViewIdForWindow(CoreWindow.GetForCurrentThread());

            PlatformBase.CurrentCore.Logger.Log(LogLevels.Debug, $"Closed secondary window with ID {windowID}");
            AppWindows.Remove(windowID);
            ApplicationView.GetForCurrentView().Consolidated -= View_Consolidated;
            Window.Current.Close();
        }
コード例 #13
0
        private void OnViewConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            ViewModel = null;
            Bindings.StopTracking();
            frame.Navigate(typeof(Page));
            var appView = ApplicationView.GetForCurrentView();

            appView.Consolidated -= OnViewConsolidated;
            ServiceLocator.DisposeCurrent();
        }
コード例 #14
0
        private async void PropsView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            propsView.Consolidated -= PropsView_Consolidated;
            propsView = null;

            if (SecurityProperties != null)
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => SecurityProperties.GetFilePermissions()); // Reload permissions
            }
        }
コード例 #15
0
 private void Properties_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     AppSettings.ThemeModeChanged -= AppSettings_ThemeModeChanged;
     ApplicationView.GetForCurrentView().Consolidated -= Properties_Consolidated;
     if (tokenSource != null && !tokenSource.IsCancellationRequested)
     {
         tokenSource.Cancel();
         tokenSource = null;
     }
 }
コード例 #16
0
        private void LyricsView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            if (LyricsView == null)
            {
                return;
            }

            LyricsView.Consolidated -= LyricsView_Consolidated;
            LyricsView = null;
        }
コード例 #17
0
        private void OnViewConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            ViewModel.Unsubscribe();
            ViewModel = null;
            Bindings.StopTracking();
            var appView = ApplicationView.GetForCurrentView();

            appView.Consolidated -= OnViewConsolidated;
            ServiceLocator.DisposeCurrent();
        }
コード例 #18
0
        private async void MainPage_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine("Main page consolidated: " + args.IsUserInitiated);

            if (args.IsUserInitiated)
            {
                // you could so saving here

                await HidePreviewWindowAsync(true);
            }
        }
コード例 #19
0
        private void ApplicationView_OnConsolidated(ApplicationView s, ApplicationViewConsolidatedEventArgs e)
        {
            if (e.IsAppInitiated || e.IsUserInitiated)
            {
                s.Consolidated -= ApplicationView_OnConsolidated;

                DataContext = null;

                // this is only required if you are using compiled bindings (x:Bind)
                Bindings.StopTracking();
            }
        }
コード例 #20
0
 private async void CurrentView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     // Clean up code to shut down the SqlBridge app as this one closes
     if ((App.Current as App).DatabaseServiceConnection != null)
     {
         // Signal app service console app to close itself
         ValueSet valueSet = new ValueSet();
         valueSet.Add("request", "Exit");
         var ignored = await(App.Current as App).DatabaseServiceConnection.SendMessageAsync(valueSet);
     }
     Application.Current.Exit();
 }
コード例 #21
0
 private async void CurrentView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     // Since this main window is closing, close down the whole app
     if ((App.Current as App).DatabaseServiceConnection != null)
     {
         // Signal app service console app to close itself
         ValueSet valueSet = new ValueSet();
         valueSet.Add("request", "Exit");
         var ignored = await(App.Current as App).DatabaseServiceConnection.SendMessageAsync(valueSet);
     }
     Application.Current.Exit();
 }
コード例 #22
0
ファイル: App.xaml.cs プロジェクト: TaoziDB/Hohoema
 private void View_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     if (sender.Id == MainViewId)
     {
         var localObjectStorageHelper = Container.Resolve <Microsoft.Toolkit.Uwp.Helpers.LocalObjectStorageHelper>();
         if (_PrevWindowSize != default(Size))
         {
             localObjectStorageHelper.Save(HohoemaViewManager.primary_view_size, _PrevWindowSize);
         }
         MainViewId = -1;
     }
 }
コード例 #23
0
 private void Properties_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     AppSettings.ThemeModeChanged -= AppSettings_ThemeModeChanged;
     AppSettings.PropertyChanged  -= AppSettings_PropertyChanged;
     // TODO: Replace this when windowing support is added
     //ApplicationView.GetForCurrentView().Consolidated -= Properties_Consolidated;
     //if (tokenSource != null && !tokenSource.IsCancellationRequested)
     //{
     //    tokenSource.Cancel();
     //    tokenSource.Dispose();
     //    tokenSource = null;
     //}
 }
コード例 #24
0
 /// <summary>
 /// 窗口已关闭
 /// </summary>
 private void NewAppView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     viewClosed = true;
     if (!CacheView)
     {
         //选择不缓存的页面退出后导航到一个空白页
         frame.Navigate(typeof(Page));
         //清理Frame历史记录
         frame.BackStack.Clear();
         frame.ForwardStack.Clear();
     }
     GC.Collect();
 }
コード例 #25
0
        private async void LogViewPage_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            ApplicationView.GetForCurrentView().Consolidated -= LogViewPage_Consolidated;

            await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                           () =>
            {
                _logView                = null;
                _logViewFrame           = null;
                ViewModel.DataReceived -= ViewModel_DataReceived;
                ViewLogButton.IsChecked = false;
            });
        }
コード例 #26
0
        private void MainWindowView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            if (PlayerWindow == null)
            {
                App.Current.Exit();
            }

            if (sender.Id == PlayerWindow.ViewId)
            {
                PlayerWindow.Closed();
            }
            else
            {
                App.Current.Exit();
            }
        }
コード例 #27
0
        private void ApplicationView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            if (_callLifetime != null)
            {
                _callLifetime.StopViewInUse();
                _callLifetime.WindowWrapper.Window.Close();
                _callLifetime = null;
            }

            if (_callPage != null)
            {
                _callPage.Dispose();
                _callPage = null;
            }

            Aggregator.Publish(new UpdateCallDialog(_call, false));
        }
コード例 #28
0
        private async void SecondaryAppView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            await SecondaryViewPlayerNavigationService.NavigateAsync(nameof(Views.BlankPage), new SuppressNavigationTransitionInfo());

            // Note: 1803時点での話
            // VisibleBoundsChanged がアプリ終了前に呼ばれるが
            // この際メインウィンドウとセカンダリウィンドウのウィンドウサイズが互い違いに送られてくるため
            // 直前のウィンドウサイズの値を前々回表示のウィンドウサイズ(_PrevSecondaryViewSize)で上書きする
            if (_PrevSecondaryViewSize != default(Size))
            {
                var localObjectStorageHelper = App.Current.Container.Resolve <Microsoft.Toolkit.Uwp.Helpers.LocalObjectStorageHelper>();
                localObjectStorageHelper.Save(secondary_view_size, _PrevSecondaryViewSize);
            }

            _scheduler.Schedule(() =>
            {
                IsShowSecondaryView = false;
            });
        }
コード例 #29
0
        private async void SecondaryAppView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
        {
            SecondaryViewPlayerNavigationService.Navigate(nameof(Views.BlankPage), null);

            // Note: 1803時点での話
            // VisibleBoundsChanged がアプリ終了前に呼ばれるが
            // この際メインウィンドウとセカンダリウィンドウのウィンドウサイズが互い違いに送られてくるため
            // 直前のウィンドウサイズの値を前々回表示のウィンドウサイズ(_PrevSecondaryViewSize)で上書きする
            if (_PrevSecondaryViewSize != default(Size))
            {
                var localObjectStorageHelper = App.Current.Container.Resolve <Microsoft.Toolkit.Uwp.Helpers.LocalObjectStorageHelper>();
                localObjectStorageHelper.Save(secondary_view_size, _PrevSecondaryViewSize);
            }

            // セカンダリウィンドウを閉じるタイミングでキャッシュを再開する
            // プレミアム会員の場合は何もおきない
            var cacheManager = App.Current.Container.Resolve <VideoCacheManager>();
            await cacheManager.ResumeCacheDownload();
        }
コード例 #30
0
 private async void MainView_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     if (sender == MainView)
     {
         await CoreAppView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
         {
             if (AppView != null)
             {
                 if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 4))
                 {
                     await AppView.TryConsolidateAsync();
                 }
                 else
                 {
                     App.Current.Exit();
                 }
             }
         });
     }
 }
コード例 #31
0
 private void ReadingPage_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
 }
コード例 #32
0
ファイル: WindowService.cs プロジェクト: h82258652/Samples
 static void Helper_Consolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
     sender.Consolidated -= Helper_Consolidated;
     if (!CoreApplication.GetCurrentView().IsMain)
         Window.Current.Close();
 }
コード例 #33
0
 void IApplicationViewEventSink.OnConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs args)
 {
 }
コード例 #34
0
 // A view is consolidated with other views hen there's no way for the user to get to it (it's not in the list of recently used apps, cannot be
 // launched from Start, etc.) A view stops being consolidated when it's visible--at that point the user can interact with it, move it on or off screen, etc. 
 // It's generally a good idea to close a view after it has been consolidated, but keep it open while it's visible.
 private void ViewConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs e)
 {
     StopViewInUse();
 }
コード例 #35
0
 // A view is consolidated with other views hen there's no way for the user to get to it (it's not in the list of recently used apps, cannot be
 // launched from Start, etc.) A view stops being consolidated when it's visible--at that point the user can interact with it, move it on or off screen, etc. 
 // It's generally a good idea to close a view after it has been consolidated, but keep it open while it's visible.
 private void ViewConsolidated(ApplicationView sender, ApplicationViewConsolidatedEventArgs e)
 {
     Consolidated = true;
 }