Show a different view the first time you launch the app

I inherited the Windows Phone code which I have to change. I need to show the user a tutorial on how to use the app when they first launch it. However, I cannot change the current view ...

Here is my code:

    public LoginView()
    {
        InitializeComponent();
        this.DataContext = new LoginViewModel();
        if (ApplicationFirstLaunched() == true)
        {
           NavigationManager.Current.Navigate(ApplicationView.DemoView);
        }
    }

      

The function ApplicationFirstLaunched

works fine (I use IsolatedStorageSettings

to store a boolean value), but the view never changes. I thought maybe the call Navigate

was wrong, so I created a button in my view and assigns the Click

following function to the property :

 private void demoBtn_Click(object sender, RoutedEventArgs e)
 {
    NavigationManager.Current.Navigate(ApplicationView.DemoView);
 }

      

When I click the button, the view changes and the tutorial appears. What should I do to show a different view on first launch? Thanks to

+3


source to share


1 answer


Go to the OnNavigatedTo method.



protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
    if (ApplicationFirstLaunched() == true)
    {
       NavigationManager.Current.Navigate(ApplicationView.DemoView);
    }
}

      

+1


source







All Articles