Microsoft が提供するガイドに従って拡張スプラッシュ スクリーンを作成しました。画面が表示されず、データが読み込まれますが、アプリはランディング ページに移動しません。これはどのように可能ですか?
ExtendedSplash.xaml.cs
public sealed partial class ExtendedSplash
{
public ExtendedSplash(SplashScreen splash)
{
this.InitializeComponent();
// Position the extended splash screen image in the same location as the splash screen image.
this.extendedSplashImage.SetValue(Canvas.LeftProperty, splash.ImageLocation.X);
this.extendedSplashImage.SetValue(Canvas.TopProperty, splash.ImageLocation.Y);
this.extendedSplashImage.Height = splash.ImageLocation.Height;
this.extendedSplashImage.Width = splash.ImageLocation.Width;
// Position the extended splash screen's progress ring.
this.ProgressRing.SetValue(Canvas.TopProperty, splash.ImageLocation.Y + splash.ImageLocation.Height + 32);
this.ProgressRing.SetValue(Canvas.LeftProperty,
splash.ImageLocation.X +
(splash.ImageLocation.Width / 2) - 15);
}
public void onSplashScreenDismissed(SplashScreen sender, object args)
{
}
}
App.xaml.cs から
protected override async void OnLaunched(LaunchActivatedEventArgs args)
{
_newsDataSource = (NewsDataSource)App.Current.Resources["newsDataSource"];
_movieDataSource = (MovieDataSource)App.Current.Resources["moviesDataSource"];
await PerformDataFetch();
// extended splash screen loading
ExtendedSplash eSplash = new ExtendedSplash(args.SplashScreen);
args.SplashScreen.Dismissed +=
new TypedEventHandler<SplashScreen, object>(eSplash.onSplashScreenDismissed);
// Place the frame in the current Window
Window.Current.Content = eSplash;
Window.Current.Activate();
}
internal async Task PerformDataFetch()
{
// load news
if (_newsDataSource != null)
{
if (!_newsDataSource.News.Any())
{
await _newsDataSource.GetNewsAsync();
}
}
// load movies
if (_movieDataSource != null)
{
if (!_movieDataSource.Movies.Any())
{
await _movieDataSource.GetMoviesAsync();
}
}
RemoveExtendedSplash();
}
internal void RemoveExtendedSplash()
{
Window.Current.Content = new MainPage();
Window.Current.Activate();
}
最後のメソッドにブレークポイントを設定すると、メソッドが起動しますが、ページへの遷移はありません。私は ProgressRing のアニメーションが好きですが、アプリは何か他のこともすべきです :)