5 秒后自动重定向到另一个 xaml 页面

Automatically redirecting to another xaml page after 5 seconds

我正在开发 Windows Phone 8.1 应用程序。我想知道如何在 5 秒后重定向到另一个 xaml 页面。 我想执行以下操作: 当我点击注销按钮时,它应该导航到另一个页面(我可以很容易地做到这一点)但我想要的是该页面不应显示超过 5 秒,它应该在 5 秒后导航到其他特定页面.

    using System.Threading.Tasks;

    //...

    private async void LogOut()
    {
        await Task.Delay(5000); //wait for 5 seconds asynchronously 
        //TODO: perform navigate
    }
 DispatcherTimer timer;
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (timer == null)
            {
                timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(5) };
                timer.Tick += Timer_Tick;
                timer.Start();
            }
        }
 private void Timer_Tick(object sender, object e)
        {
            timer.Stop();
            Frame.Navigate(typeof(MainPage));//Give your page here
        }