【问题标题】:build a custom SplashScreen in Windows Phone 8在 Windows Phone 8 中构建自定义 SplashScreen
【发布时间】:2013-09-20 16:37:29
【问题描述】:

我必须为我的应用程序构建一个自定义 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

我该怎么办?

【问题讨论】:

  • 它真的会加载任何东西吗?您应该等到完成加载后才能导航
  • 不,它实际上并没有加载任何页面,它实际上是我公司为其他公司开发应用程序的广告
  • 谢谢你的信息。您可能只想使用在页面加载时启动的情节提要,并在完成后导航到下一页

标签: c# xaml windows-phone splash-screen


【解决方案1】:

在另一个论坛上,他们向我推荐了这个解决方案:

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();

有效!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多