Frage

I am developing an app for Windows Phone 8 in VS2012 and My StartUp Project page is SetProfile.XAML which creates the profile for the first time, but if the user is entering the app second time, the page must not appear because there is already an existing profile.

So I have this code for the "Loaded" event handler, which checks if there is a created profile and if there is, navigates to MainPage page.

private void PhoneApplicationPage_Loaded_1(object sender, RoutedEventArgs e)
{
    if (Flag.Contains("true"))
    {
        if (IsolatedStorageSettings.ApplicationSettings.Contains("player1"))
            if (!(Flag.Contains("false")))
                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));                 
    }
}

The problem is when I enter a second time, I see a blink of the SetProfile.XAML page then it navigates (it's like milliseconds), but I still can see it.

Is there any way I can make it faster so the user won't see it?

War es hilfreich?

Lösung

There is a very good blogpost about how to 'navigate' to a screen that is not always needed up on Shawn's blog here http://www.visuallylocated.com/post/2012/06/18/Using-a-custom-UriMapper-to-navigate-to-a-login-screen.aspx

The trick is to use a custom UriMapper class that checks all the info and determines the correct navigation uri. You use this class in your app.xaml.cs - Application_Launching and Application_Activated

Andere Tipps

you see blink as you have used "Loaded" event,it loads page in run time and must not used unnecessary.

You must use "OnNavigatedTo" event for these normal scenarios.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top