0

アプリ用のカスタム SplashScreen を作成する必要があります。画像とローディングアイコンが回転するだけで、特別なことは何もありません。問題は、このスプラッシュ画面が 850 ミリ秒表示されてからメイン メニューに移動する必要があることですが、これを行う方法がわかりません....試してみました

System.Threading.Thread.Sleep(850);

そしてこの解決策:

protected override void OnNavigatedTo(NavigationEventArgs e)
    {
        System.Diagnostics.Stopwatch stopwatch = System.Diagnostics.Stopwatch.StartNew();
        while (true)
        {
            //some other processing to do possible
            if (stopwatch.ElapsedMilliseconds >= 850)
            {
                break;
            }
        }
        NavigationService.Navigate(new Uri("/MainMenu.xaml", UriKind.Relative));
    }

しかし、何も機能していないようで、アプリはすぐに MainMenu に移動します

どのようにできるのか?

4

1 に答える 1

0

別のフォーラムで、彼らは私にこの解決策を提案しています:

using System.Windows.Threading;
DispatcherTimer Timer = new DispatcherTimer()
{
    Interval = TimeSpan.FromMilliseconds(850)
};
Timer.Tick += (s, e) =>
{
    Timer.Stop();
    NavigationService.Navigate(new Uri("/MainMenu.xaml", UriKind.Relative));        
};
Timer.Start();

できます!

于 2013-09-20T16:45:58.113 に答える