Ejemplo n.º 1
0
 private void ShowDebugLogWndExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     debugLogWnd         = new DebugLogWindow();
     debugLogWnd.Closed += (o, args) => { debugLogWnd = null; };
     debugLogWnd.Show();
 }
Ejemplo n.º 2
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            var exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            Directory.SetCurrentDirectory(exeDir);

            Log.Instance.Debug("App_Startup called. Starting application.");

            AppDomain.CurrentDomain.UnhandledException += AppDomainOnUnhandledException;
            CmdArgumentsParser.Init(e);

            try
            {
                // Ensure the current culture passed into bindings is the OS culture.
                // By default, WPF uses en-US as the culture, regardless of the system settings.
                FrameworkElement.LanguageProperty.OverrideMetadata(
                    typeof(FrameworkElement),
                    new FrameworkPropertyMetadata(
                        XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
            }
            catch (Exception ex)
            {
                Log.Instance.Error("LanguageProperty.OverrideMetadata throw exception: " + ex.Message);
            }

            if (SystemConfigFlagsWrapper.Instance().PipeManager)
            {
                ShutdownMode = ShutdownMode.OnExplicitShutdown;
                CreateAndStartPipeManager(e);
            }
            else
            {
                ShutdownMode = ShutdownMode.OnMainWindowClose;
            }

            try
            {
                var startInfo = new System.Diagnostics.ProcessStartInfo("GUP.exe")
                {
                    WorkingDirectory = "updater"
                };

                System.Diagnostics.Process.Start(startInfo);
            }
            catch (Exception ex)
            {
                Log.Instance.Error("Checking for update failed: " + ex.Message);
            }

            if (AppAlreadyRuns)
            {
                return;
            }

            if (SystemConfigFlagsWrapper.Instance().TrayIcon)
            {
                TrayIconManager.CreateIcon();
            }

            if (SystemConfigFlagsWrapper.Instance().ShowDebugLogWindow)
            {
                var wnd = new DebugLogWindow();
                wnd.Show();
            }

            var visibility = Visibility.Visible;

            if (e.Args.Length > 0 && e.Args[0] == "-scheduled")
            {
                visibility = Visibility.Collapsed;
            }

            Helper.OpenNewIndexerWnd(visibility);
        }