简体   繁体   中英

C# Splash screen not working

I've been stuck here for a few hours looking up code for hours and making batches of my own. One of the code ex I got from here gave me a instant svHost error.

Now my splash screen is my HWID / Serial check, if valid it opens the main form if not it closes the app completely.. But the issue is I've tried some way's with splash.show(); on the main form but it just freezes and goes all stupid for a few minutes, another thing most of the methods use timers I just need it so when HWID check is valid I can start the main form, I've tried application.Run(new mainForm()); if the HWID was correct then changed the program.cs file around but still no luck, I really need the help. It would be wonderful, thank's.

I've used splash screen animation while I'm connecting to socket. I've used backgroundworker for it.

Here's my code:

Main Form

LoadingScreen frmLoadingScreen = new LoadingScreen();
.....
bkwNetworkConnector.RunWorkerAsync();

frmLoadingScreen.ShowDialog();

 /***********************************************************************************************************************/
        private void bkwNetworkConnector_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                hostSocket = new TcpClient();
                hostSocket.Connect(strIp, intPort);
            }
            catch (Exception exp)
            {

            }
        }

        private void bkwNetworkConnector_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            frmLoadingScreen.Close();

        }

LoadingScreen Form:

with imagebox control. Load GIF image in it.

private void LoadingScreen_Load(object sender, EventArgs e)
        {
            pbAnimationBox.Image = Properties.Resources.LoadingAnimation; // win 8 animation
        }

I'm using LoadingScreen Form as splash screen.

Hope this will hep you....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM