Maybe beginners all have a certain question about a program login jump transfer, my main program is not a login form, how to switch from the login form to the main form and so on. Now I'm going to put some code in the actual project and see
1 /// <summary>2 ///The main entry point for the application. 3 /// </summary>4 [STAThread]5 Static voidMain (string[] args)6 {7 application.enablevisualstyles ();8Application.setcompatibletextrenderingdefault (false);9 Reset:Ten //---------------------------------------------- One //Start Login A //---------------------------------------------- -Frmlogin Frmlogin =NewFrmlogin (); - Application.Run (frmlogin); the if(Frmlogin.dialogresult = =DialogResult.OK) - { - //Successful login opens the application main program -Frmmain Frmmain =Newfrmmain (); + Application.Run (frmmain); - //Log off to restart the login window + if(Frmmain.dialogresult = =DialogResult.OK) A { at GotoReset; - } - } -}
The above code for login jump, do not know can leave a message ha.
Let's talk about a program upgrade idea, there may be a lot of ways, I would like to make a thought
I don't know what to do, but you can ask me.
Now there is a way to upgrade, is to give the upgrade list, and then through the way the file download to update (to make an update in advance)
Another is IE open exe way, this way update is relatively simple, updated which module directly lost the corresponding module to the server, so that the client can be reopened, need to be in advance in the project structure allocation of modules, so that the later module update is more convenient, there will not be said a solution thing too much, Debugging a build solution is slow.
Scenarios for upgrading
Need to ensure that the server can be connected, you can use ping to test whether you can connect to the server, if you can not switch to the standby server, two can not consider their own network or server network problems. Download files are generally HTTP
As for the version of the comparison can be used String.Compare to judge, the previous parameter is the server version number, the second parameter is the local version number, as for the other parameters to see their own needs, is generally ignored case, the third parameter is True
System.Diagnostics.ProcessStartInfo startinfo = new System.Diagnostics.ProcessStartInfo (file address, server address + "|" + old EXE program name + " | "+ new EXE program +" |>| "+ server file list);
C/S login Jump/System upgrade