Esempio n. 1
0
        private static void Main(string[] args)
        {
#if !DEBUG
            try
            {
#endif

            Application.ApplicationExit += (s, e) => Properties.Settings.Default.Save();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Environment.CurrentDirectory = ApplicationDirectory;

            Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentCulture;
            Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr"); //forces french translations to be used

            //Don't start application if arguments/files were being handled (except --open)
            if (HandleArguments(args))
            {
                return;
            }

            //Check if application is running already
            if (!Mutex.WaitOne(TimeSpan.Zero, true))
            {
                //Send broadcast to show the window of the current instance.
                NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);
                return;
            }

            #region Splash Screen Code

            using (var splash = new SplashForm())
            {
                splash.Show();

                splash.SetStatus(Properties.Strings.Splash_Folders);
                splash.statusBar.Value = 20;

                CreateFolders();

                splash.SetStatus(Properties.Strings.Splash_DetectOS);
                _ = OperatingSystemVersions.CurrentVersion;
                splash.statusBar.Value = 40;

                splash.SetStatus(Properties.Strings.Splash_Extensions);
                Loader.LoadExtensions();
                splash.statusBar.Value = 60;

                splash.SetStatus(Properties.Strings.Splash_Backups);
                LoadBackups();
                splash.statusBar.Value = 80;

                splash.SetStatus(Properties.Strings.Splash_Pages);
                InitializePages();
                splash.statusBar.Value = 100;

#if DEBUG
                splash.SetStatus(Properties.Strings.Splash_Debug);
                Pages.Add(new DebugPage());
#endif

                splash.Hide();
            }

            #endregion Splash Screen Code
            using (var main = new MainForm())
            {
                System.Media.SoundPlayer player = new System.Media.SoundPlayer(Properties.Resources.test); //this loads in the startup sound
                player.Play();                                                                             //it plays said sound

                Application.Run(main);
            }

#if !DEBUG
        }

        catch (Exception ex)
        {
            SendCrashReport(ex);
            throw;
        }
#endif
        }
Esempio n. 2
0
        private static void Main(string[] args)
        {
#if !DEBUG
            try
            {
#endif

            Application.ApplicationExit += (s, e) => Properties.Settings.Default.Save();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Environment.CurrentDirectory = ApplicationDirectory;

            Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentCulture;
            //Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("fr");

            //Don't start application if arguments/files were being handled (except --open)
            if (HandleArguments(args))
            {
                return;
            }

            //Check if application is running already
            if (!Mutex.WaitOne(TimeSpan.Zero, true))
            {
                //Send broadcast to show the window of the current instance.
                NativeMethods.PostMessage((IntPtr)NativeMethods.HWND_BROADCAST, NativeMethods.WM_SHOWME, IntPtr.Zero, IntPtr.Zero);
                return;
            }

            using (var splash = new SplashForm())
            {
                splash.Show();

                splash.SetStatus("Creating folders...");
                CreateFolders();

                splash.SetStatus("Retrieving OS Version...");
                _ = OperatingSystemVersions.CurrentVersion;

                splash.SetStatus("Loading extensions...");
                Loader.LoadExtensions();

                splash.SetStatus("Loading backups...");
                LoadBackups();

                splash.SetStatus("Initializing pages...");
                InitializePages();

#if DEBUG
                splash.SetStatus("Unlocking debug page...");
                Pages.Add(new DebugPage());
#endif

                splash.Hide();
            }

            using (var main = new MainForm())
            {
                Application.Run(main);
            }

#if !DEBUG
        }

        catch (Exception ex)
        {
            SendCrashReport(ex);
            throw;
        }
#endif
        }