Exemplo n.º 1
0
 public static void CloseMe()
 {
     if (splash.InvokeRequired)
     {
         splash.Invoke(new MethodInvoker(CloseMe));
     }
     else
     {
         if (!splash.IsDisposed)
         {
             splash.Close();
         }
     }
 }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            initialiseFiles();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            #region SplashScreen
            Form splash = new Splash();
            splash.Show();
            DateTime splashed = DateTime.Now;
            while (DateTime.Now < splashed.AddSeconds((System.Diagnostics.Debugger.IsAttached ? 1 : 2)) && !splash.IsDisposed)
            {
                Application.DoEvents();
                System.Threading.Thread.Sleep(100);
            }
            if (!splash.IsDisposed)
            {
                splash.Close();
            }
            #endregion

            log.Debug("Loading settings from file.");
            Settings.Load();
            isNewVersion();
            checkForUpdate();

            try {
                Application.Run(new MainForm(startingTab));
                OutlookCalendar.Instance.IOutlook.Disconnect();
            } catch (ApplicationException ex) {
                log.Fatal(ex.Message);
                MessageBox.Show(ex.Message, "Application terminated!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            } catch (Exception ex) {
                log.Fatal("Application unexpectedly terminated!");
                log.Fatal(ex.Message);
                log.Fatal(ex.StackTrace);
                MessageBox.Show(ex.Message, "Application unexpectedly terminated!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                OutlookCalendar.Instance.IOutlook.Disconnect();
            }
            GC.Collect();
            GC.WaitForPendingFinalizers();
            log.Info("Application closed.");
        }
Exemplo n.º 3
0
        private static void Main(string[] args) {
            initialiseFiles();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            #region SplashScreen
            Form splash = new Splash();
            splash.Show();
            DateTime splashed = DateTime.Now;
            while (DateTime.Now < splashed.AddSeconds((System.Diagnostics.Debugger.IsAttached ? 1 : 2)) && !splash.IsDisposed) {
                Application.DoEvents();
                System.Threading.Thread.Sleep(100);
            }
            if (!splash.IsDisposed) splash.Close();
            #endregion

            log.Debug("Loading settings from file.");
            Settings.Load();
            isNewVersion();
            checkForUpdate();

            try {
                Application.Run(new MainForm(startingTab));
                OutlookCalendar.Instance.IOutlook.Disconnect();
            } catch (ApplicationException ex) {
                log.Fatal(ex.Message);
                MessageBox.Show(ex.Message, "Application terminated!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            } catch (Exception ex) {
                log.Fatal("Application unexpectedly terminated!");
                log.Fatal(ex.Message);
                log.Fatal(ex.StackTrace);
                MessageBox.Show(ex.Message, "Application unexpectedly terminated!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                OutlookCalendar.Instance.IOutlook.Disconnect();
            }
            GC.Collect();
            GC.WaitForPendingFinalizers();
            log.Info("Application closed.");
        }