private static void closeSplash(frmSplash form) { if (!form.IsDisposed) { if (form.InvokeRequired) { form.Invoke(new closeSplashDlg(closeSplash), new object[] { form }); } else { form.Close(); } } }
private static void setOpacity(frmSplash form, float opacity) { if (!form.IsDisposed) { if (form.InvokeRequired) { form.Invoke(new setOpacityDlg(setOpacity), new object[] { form, opacity }); } else { form.Opacity = opacity; } } }
static void showHideSplash(object obj) { frmSplash form = obj as frmSplash; if (obj != null) { for (float opacity = 0.0f; opacity < 1.0f; opacity += 0.05f) { setOpacity(form, opacity); Thread.Sleep(20); } Thread.Sleep(1500); for (float opacity = 1.0f; opacity > 0.0f; opacity -= 0.05f) { setOpacity(form, opacity); Thread.Sleep(20); } closeSplash(form); } }
static void Main() { string logPath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "UWOLMaps.log"); try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (Properties.Settings.Default.MostrarSplash) { frmSplash splash = new frmSplash(); splash.Show(); Thread showSplash = new Thread(new ParameterizedThreadStart(showHideSplash)); showSplash.Start(splash); } Application.Run(new frmEditor()); } catch (Exception ex) { System.IO.File.AppendAllText(logPath, ex.ToString() + "\\n"); throw ex; } }