Exemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (Process.GetProcessesByName("GW2PAO").Count() > 1)
            {
                // Application is already running
                Application.Current.Shutdown();
                return;
            }

            // Log application information
            var executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();

            System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(executingAssembly.Location);
            logger.Info("Application starting - " + executingAssembly.GetName().Name + " - " + executingAssembly.GetName().Version + " - " + fvi.FileVersion + " - " + fvi.ProductVersion);

            // Software only mode provides improved performance when using transparent windows and hardware acceleration is not available
            if ((System.Windows.Media.RenderCapability.Tier >> 16) == 0)
            {
                logger.Info("Hardware acceleration unavailable - setting ProcessRenderMode to SoftwareOnly");
                System.Windows.Media.RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
            }
            else
            {
                logger.Info("Hardware acceleration available - leaving ProcessRenderMode");
            }

            base.OnStartup(e);

            this.InitializeSettings();
            this.InitializeLogging();

            // Initialize the last chance exception handlers
            logger.Debug("Registering last chance exception handlers");
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            this.InitializeInternationalization();

            if (GW2PAO.Properties.Settings.Default.CheckForUpdates)
            {
                UpdateChecker.CheckForUpdateAndNotify();
            }

            ApplicationBootstrapper ab = new ApplicationBootstrapper();

            ab.Run();

            Commands.ApplicationShutdownCommand.RegisterCommand(new DelegateCommand(this.DoShutdown));

            GW2PAO.Properties.Settings.Default.FirstTimeRun = false;
            GW2PAO.Properties.Settings.Default.Save();

            // Disable client-side connection throttling
            ServicePointManager.DefaultConnectionLimit = int.MaxValue;
        }
Exemplo n.º 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (Process.GetProcessesByName("GW2PAO").Count() > 1)
            {
                // Application is already running
                Application.Current.Shutdown();
                return;
            }

            // Software only mode provides improved performance when using transparent windows
            System.Windows.Media.RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;

            base.OnStartup(e);

            this.InitializeSettings();
            this.InitializeLogging();

            // Log application information
            var executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
            System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(executingAssembly.Location);
            logger.Info("Application starting - " + executingAssembly.GetName().Name + " - " + executingAssembly.GetName().Version + " - " + fvi.FileVersion + " - " + fvi.ProductVersion);

            // Initialize the last chance exception handlers
            logger.Debug("Registering last chance exception handlers");
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            this.InitializeInternationalization();

            if (GW2PAO.Properties.Settings.Default.CheckForUpdates)
                UpdateChecker.CheckForUpdateAndNotify();

            ApplicationBootstrapper ab = new ApplicationBootstrapper();
            ab.Run();

            Commands.ApplicationShutdownCommand.RegisterCommand(new DelegateCommand(this.DoShutdown));

            GW2PAO.Properties.Settings.Default.FirstTimeRun = false;
            GW2PAO.Properties.Settings.Default.Save();

            // Disable client-side connection throttling
            ServicePointManager.DefaultConnectionLimit = int.MaxValue;
        }