开发者

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 t开发者_StackOverflow中文版o 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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜