別のビューを動的に作成する UWP アプリがあります。しかし、問題は、最初のウィンドウを閉じると、2番目のウィンドウがまだオンのままになることです。
このコードで、新しいビューを作成しています:
CoreApplicationView newView = CoreApplication.CreateNewView();
int newViewId = 0;
await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Frame frame = new Frame();
frame.Navigate(typeof(SecondPage), null);
Window.Current.Content = frame;
// You have to activate the window in order to show it later.
Window.Current.Activate();
newViewId = ApplicationView.GetForCurrentView().Id;
});
bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
ユーザーが最初のウィンドウを閉じたときにアプリケーションを閉じる方法は?