Пример #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            ThemeManager.InitColorTheme(Settings.ColorTheme);

            CreateJumpList();

            Settings.PropertyChanged -= Settings_PropertyChanged;
            Settings.PropertyChanged += Settings_PropertyChanged;

            // For now we want to allow multiple instances if app is started without args
            if (Mutex.TryOpenExisting(_instanceMuxet, out var mutex))
            {
                var client = new PipeClient(Config.PipeEndpoint);

                if (e.Args.Any())
                {
                    client.InvokeCommand(CmdlineCommands.Open, e.Args[0]);
                    Shutdown();
                    return;
                }
            }
            else
            {
                _appMutex        = new Mutex(true, _instanceMuxet);
                OriginalInstance = true;
            }
        }
Пример #2
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
#if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
#endif
            Config.ConfigureLogger();

            ThemeManager.SetColorTheme(Settings.ColorTheme);

            // For now we want to allow multiple instances if app is started without args
            if (Mutex.TryOpenExisting(_instanceMuxet, out var mutex))
            {
                var client = new PipeClient(Config.PipeEndpoint);

                if (e.Args.Any())
                {
                    client.InvokeCommand(CmdlineCommands.Open, e.Args[0]);
                    Shutdown();
                    return;
                }
            }
            else
            {
                _appMutex        = new Mutex(true, _instanceMuxet);
                OriginalInstance = true;
            }
        }
Пример #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (e.Args?.Any() == true)
            {
                Properties["ArbitraryArgName"] = e.Args[0];
            }

            // For now we want to allow multiple instances if app is started without args
            if (Mutex.TryOpenExisting(_instanceMuxet, out var mutex))
            {
                var client = new PipeClient(Config.PipeEndpoint);

                if (e.Args.Any())
                {
                    client.InvokeCommand(CmdlineCommands.Open, e.Args[0]);
                    Shutdown();
                    return;
                }
            }
            else
            {
                _appMutex        = new Mutex(true, _instanceMuxet);
                OriginalInstance = true;
            }

            if (Resources["bootstrapper"] == null)
            {
                StartupUri = new System.Uri(@"Windows\MainWindow.xaml", System.UriKind.Relative);
            }
            else
            {
                ShutdownMode = ShutdownMode.OnLastWindowClose;
            }

            base.OnStartup(e);
        }