private void loadingscreen_Shown(object sender, EventArgs e) //happens right after it's shown BUT NOT FULLY DRAWN! Load happened BEFORE, so it makes a blank gap. { _synchronizationContext = SynchronizationContext.Current; _myTimer = new System.Windows.Forms.Timer { Interval = 200 }; _myTimer.Tick += Kostil; _myTimer.Start(); //as it's not fully drawn but we WANT it to we set a small timer. The timer works in an another thread so the UI thread will be able to finish drawing. ProgressLoading.Invoke(new MethodInvoker(delegate { ProgressLoading.Value = 20; })); }
private void Kostil2() { ProgressLoading.Invoke(new MethodInvoker(delegate { ProgressLoading.Value = 40; })); _mainForm = new Main(this); //launch Main form to access vars, but don't show it ProgressLoading.Invoke(new MethodInvoker(delegate { ProgressLoading.Value = 60; })); LoadLogs(); CheckForCorruptions(); ReadLogs(0); ProgressLoading.Invoke(new MethodInvoker(delegate { ProgressLoading.Value = 80; })); EnableTimer(); UpdateDatabase(); LoadLocalDatabase(); ProgressLoading.Invoke(new MethodInvoker(delegate { ProgressLoading.Value = 100; })); LoadChangelog(); System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location); Invoke(new MethodInvoker(delegate { CreateIconMenuStructure(); _mainForm.Ver = fvi.FileVersion; _mainForm.labelYoVersionLab.Text = _mainForm.Ver + @" " + Main.Build; _mainForm.TopMost = true; _mainForm.Show(); Hide(); Controls.Clear(); _mainForm.TopMost = false; Text = @"InfANT Helper"; })); //show the main form, hides this form and sets the name of it to "Helper" }