アプリケーションまたはアクティベーションを開始した後、BackgroundAudioPlayerが再生されているかどうかを確認し、再生している場合はプレーヤーのページに移動します。NavigationService を使用できないことはわかっていますが、App.xaml.cs では、Activated のように RootVisual を使用する必要があることがわかりましたが、機能していません。RootVisual が null です。最初のものにはエラーはありませんが、問題は MainPage.xaml に到達することです。どうすれば修正できますか?ありがとう
private void Application_Launching(object sender, LaunchingEventArgs e)
{
if (BackgroundAudioPlayer.Instance.PlayerState == PlayState.Playing)
RootFrame.Navigate(new Uri("/PlayerPage.xaml", UriKind.RelativeOrAbsolute));
}
private void Application_Activated(object sender, ActivatedEventArgs e)
{
if (BackgroundAudioPlayer.Instance.PlayerState == PlayState.Playing)
(Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/PlayerPage.xaml", UriKind.RelativeOrAbsolute));
}