I have 2 pages.(MainPage.xaml,second.xaml) MainPage.xaml is the Login page. In this page I send login and password, and receive result. I save them(result) in Isolate Storage and navigate to the second.xaml page; When i start this application in the next time, i extract data from Isolate Storage and I want to navigate the second.xaml immidiately, but i don't know how
I try write
public MainPage()
{
InitializeComponent();
//function for Isolate storage
InitializeSettings();
NavigationService.Navigate(new Uri("/Conversation.xaml", UriKind.Relative));
}
But it isn't work) I understood that I could not use the navigation code associated with the MainPage() constructor. Of course, i may will do simple button, but i wish fast navigation
I think may be it connected with App.xaml method
private void Application_Launching(object sender, LaunchingEventArgs e)
for example, write my method
//function for Isolate storage
InitializeSettings();
with navigation there?(navigation not work in this example)
private void Application_Launching(object sender, LaunchingEventArgs e)
{
InitializeSettings();
NavigationService.Navigate(new Uri("/Conversation.xaml", UriKind.Relative));
}
Where I can use navigation, so go straight to the second.xaml page, without fully loading the MainPage.xaml(may be without MainPage.xaml)
You can do as Rana Tallal said.
Or you can write it in code:
public MainPage()
{
InitializeComponent();
Loaded += (s, e) =>
{
InitializeSettings();
// Some login-password check condition
if (_login && _password)
NavigationService.Navigate(new Uri("/Conversation.xaml",
UriKind.Relative));
}
}