Madhup Singh Yadav
Madhup Singh Yadav

Reputation: 8114

how to logout in windows mobile based application?

I am developing an application for windows mobile in which I have a logout functionality at each form I open.

So while pressing the logout button I am able to delete the username password from the memory but I am not able to drag the user to the login screen again while freeing all the memory and closing all the forms.

Anybody knowing the answer plz help me out.

Upvotes: 0

Views: 453

Answers (2)

Madhup Singh Yadav
Madhup Singh Yadav

Reputation: 8114

Finally I have found a way to do this though not the best way to do this. I am maintaining a static bool in login form which is set to true when user presses the logout button. Now after this at each form in OnFocus Event I check whether that variable is set to yes if it is ,I close the form and so on till i reach the login form.

If somebody knows better solution plzz tell.

Or if you like this answer plz vote it.

Upvotes: 0

Quibblesome
Quibblesome

Reputation: 25409

Try this. Your main form becomes a "shell" with a logout button (or possibly you do that via a MainMenu object). Then rewrite your other forms into UserControls instead. Then when the user "moves" to a new page just initialise the usercontrol and slap it into the .Controls collection in your shell form (oh and remove the current one first :) ).

Technically you always remain on the first form this way, you don't need to duplicate the logout code/UI and moving the user back to the login page is easy, just remove the "Current" usercontrol and replace it with the "Login" user control.

Upvotes: 1

Related Questions