Ejemplo n.º 1
0
		private static SplashForm splash;// = new SplashForm();

		internal static void Launch()
		{
			Application.CurrentCulture = CultureInfo.InvariantCulture;
            Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
		    splash = new SplashForm();
			splash.Show();
			Timer timer = new Timer();
			//Configure this timer to restart each second ( 1000 millis)
			timer.Interval = 1000;
			timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
			timer.Start();
			//splash.Refresh();
			
			//Application.DoEvents();
			Application.DoEvents();
			MainModule.Initialize("data");
			splash.SetLoadProgress(50);
			splash.Refresh();
			Application.DoEvents();

			UpdaterHelper.UpdateInfo info;
			info = UpdaterHelper.CheckFromUpdates();
			Application.DoEvents();
			if (info.UpdateAvailable)
			{
				UpdateForm updateForm;
				updateForm = new UpdateForm(info);
				updateForm.ShowDialog();
				Application.DoEvents();
			}

			splash.SetLoadProgress(60);
			splash.Refresh();
			Application.DoEvents();
			IconsManager.Initialize();
			Application.DoEvents();
			MainForm main = new MainForm();
            //if (runSingleInstance)
            //{
            //    main.HandleCreated += new EventHandler(main_HandleCreated);
            //}
			GC.Collect();
            timer.Stop();
            timer.Close();
			splash.SetLoadProgress(100);
			splash.Refresh();
			Application.DoEvents();
			splash.Close();
			splash = null;
			Application.DoEvents();
            
			Application.Run(main);
		} //Launch