在我的UWP应用程序中,我正在从协议或吐司中启动。在onactivated方法中,我想检查是否有应用程序'主视图是打开的或显示的页面。全部来自App.xaml.cs
我想做类似的事情:
If Mainpage is not showing --> Navigate(typeof(MainPage));
或
If main window is not open since i am coming from protocol or toast launch
open frame and navigate to mainpage.
不确定如何去做。
答案 0 :(得分:9)
所以我正在检查
var frame = Window.Current.Content as Frame;
if (frame != null)
{
Type whatpageisit = frame.SourcePageType;
// handle this page type
}
else
{
// do what you need to in case window not open
}