コード例 #1
0
        private void WindowMain_Loaded(object sender, RoutedEventArgs e)
        {
            positionManager.RestoreSizeAndLocation(App.Settings);
            App.Settings.PropertyChanged += Settings_PropertyChanged;

            if ((Application.Current as App).OriginalInstance)
            {
                pipeService = new PipeService();
                pipeService.CommandExecuted += PipeService_CommandExecuted;;
                pipeServer = new PipeServer(ConfigurationManager.AppSettings["PipeEndpoint"]);
                pipeServer.StartServer(pipeService);

                var args = Environment.GetCommandLineArgs();
                if (args.Count() > 1)
                {
                    PipeService_CommandExecuted(this, new CommandExecutedEventArgs(CmdlineCommands.Open, args[1]));
                }
            }
        }
コード例 #2
0
        private void WindowMain_Loaded(object sender, RoutedEventArgs e)
        {
            Title = $"LiteDB Explorer {Versions.CurrentVersion}";

            _positionManager.RestoreSizeAndLocation(App.Settings);

            App.Settings.PropertyChanged += Settings_PropertyChanged;

            if ((Application.Current as App)?.OriginalInstance == true)
            {
                _pipeService = new PipeService();
                _pipeService.CommandExecuted += PipeService_CommandExecuted;
                _pipeServer = new PipeServer(Config.PipeEndpoint);
                _pipeServer.StartServer(_pipeService);

                var args = Environment.GetCommandLineArgs();
                if (args.Length > 1)
                {
                    PipeService_CommandExecuted(this, new CommandExecutedEventArgs(CmdlineCommands.Open, args[1]));
                }
            }
        }