Click here to Skip to main content
16,015,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Suppose,
I have three pages in project.(mainpage,loginin,third)
when i start the project, mainpage opens(mainpage.xmal)

i want to make both two pages starts(mainpage,login)
so i make like this,
C#
void MainPage_Loaded(object sender, RoutedEventArgs e)
       {
           App app = (App)Application.Current;
           App.Navigate(new Login());
        }

It is Ok to start both main page and login page.

But,in third page(xxxxxx.xmal)
I have to call main page and NextPage
C#
public void Link_Click(object sender, RoutedEventArgs e)
        { 
                    App.Navigate(new MainPage());
                    App.Navigate(new NextPage());
           }


Now, that is the problem that MainPage call Login Page .That time is not OK to call Login Page.
Described In my question,

is it possible to make check condition depends on first load event?
eg
if (silverlight project first time load)
{
//OK
}

Or
How can i make show two pages at initial and than call main page only again
Thanks for any suggestions or advice.
Posted

you can create a parameterized Constructor of your MainPage like

public MainPage(bool isLogedIn)
{
if(isLogedIn)
{

}
else
{

}

}

and then call your MainPage;
 
Share this answer
 
If it is a login page then you should persist the login status (probably in a static class) and then test for it in the page loaded events. So the first time the mainpage is loaded, the check for a valid login would be false and you would redirect to the login page. Subsequent calls would test and see that login has been completed successfully and would skip the jump to the login page.
 
Share this answer
 
Comments
[no name] 26-Jun-13 3:35am    
Thanks a lot Mr.Jason Gleim.
:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900