I have a C#/XAML Windows Store App and I need to be able to perform some network/RESTful API tests in the resume handler to make sure that a token/session is still valid. If it isn't, the app needs to direct the user back to the login page.
I've tried a number of solutions on SO and for one reason or another, they won't work from within App.xaml.cs. The overarching issue seems to be my inability to get to Frame.Navigate from within the resume handler.
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
Application.Current.Resuming += new EventHandler<object>(OnResuming);
}
private async void OnResuming(object sender, object e)
{
bool success = true;
// some tests are performed here
if (!success) { /* what do I use here? */ }
}
I've tried solutions on the following pages: