Esempio n. 1
0
        //[STAThread]
        //public static void Main()
        //{

        //}

        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            // Load Supported Builds
            Manager.SupportedGame = new Manager.SupportedGames();

            // Load Settings
            Settings.LoadSettings(true);

            // Update Liberty Protocol
            LibertyProtocol.UpdateProtocol();

            // Create Temporary Directories
            VariousFunctions.CreateTemporaryDirectories();

            // Clean-up Old Temporary Files
            VariousFunctions.CleanUpTemporaryFiles();

            // Create Closing Method
            Application.Current.Exit += (o, args) =>
            {
                // Update Settings with Window Width/Height
                Settings.applicationSizeMaximize = (Settings.HomeWindow.WindowState == WindowState.Maximized);
                if (!Settings.applicationSizeMaximize)
                {
                    Settings.applicationSizeWidth  = Settings.HomeWindow.Width;
                    Settings.applicationSizeHeight = Settings.HomeWindow.Height;
                }

                // Save Settings
                Settings.UpdateSettings();
            };

            // Global Exception Catching
#if !DEBUG
            Application.Current.DispatcherUnhandledException += (o, args) =>
            {
                MetroException.Show((Exception)args.Exception);

                args.Handled = true;
            };
#endif
        }