public ShowParserErrorsCommand(INavigateCommand navigateCommand, RubberduckParserState state, ISearchResultsWindowViewModel viewModel, SearchResultPresenterInstanceManager presenterService)
 {
     _navigateCommand = navigateCommand;
     _state = state;
     _viewModel = viewModel;
     _presenterService = presenterService;
 }
예제 #2
0
        void setupRx()
        {
            if (rxObjectsSetup)
            {
                return;
            }

            NavigateBack = new ReactiveCommand(
                NavigationStack.CollectionCountChanged.StartWith(_NavigationStack.Count).Select(x => x > 0));
            NavigateBack.Subscribe(_ =>
                                   NavigationStack.RemoveAt(NavigationStack.Count - 1));

            Navigate = new NavigationReactiveCommand();
            Navigate.Subscribe(x => {
                var vm = x as IRoutableViewModel;
                if (vm == null)
                {
                    throw new Exception("Navigate must be called on an IRoutableViewModel");
                }

                NavigationStack.Add(vm);
            });

            NavigateAndReset = new NavigationReactiveCommand();
            NavigateAndReset.Subscribe(x => {
                NavigationStack.Clear();
                Navigate.Execute(x);
            });

            rxObjectsSetup = true;
        }
예제 #3
0
        public InspectionResultsViewModel(RubberduckParserState state, IInspector inspector, VBE vbe, INavigateCommand navigateCommand, IClipboardWriter clipboard,
                                          IGeneralConfigService configService, IOperatingSystem operatingSystem)
        {
            _state                    = state;
            _inspector                = inspector;
            _vbe                      = vbe;
            _navigateCommand          = navigateCommand;
            _clipboard                = clipboard;
            _configService            = configService;
            _operatingSystem          = operatingSystem;
            _refreshCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), async param => await Task.Run(() => ExecuteRefreshCommandAsync()), CanExecuteRefreshCommand);
            _disableInspectionCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteDisableInspectionCommand);
            _quickFixCommand          = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            _quickFixInModuleCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand, _ => _state.Status == ParserState.Ready);
            _quickFixInProjectCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand, _ => _state.Status == ParserState.Ready);
            _copyResultsCommand       = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);
            _openSettingsCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);

            _configService.SettingsChanged += _configService_SettingsChanged;

            _setInspectionTypeGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByInspectionType = (bool)param;
                GroupByLocation       = !(bool)param;
            });

            _setLocationGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByLocation       = (bool)param;
                GroupByInspectionType = !(bool)param;
            });

            _state.StateChanged += _state_StateChanged;
        }
 public ShowParserErrorsCommand(INavigateCommand navigateCommand, RubberduckParserState state, ISearchResultsWindowViewModel viewModel, SearchResultPresenterInstanceManager presenterService)
 {
     _navigateCommand  = navigateCommand;
     _state            = state;
     _viewModel        = viewModel;
     _presenterService = presenterService;
 }
예제 #5
0
        public InspectionResultsViewModel(
            RubberduckParserState state,
            IInspector inspector,
            IQuickFixProvider quickFixProvider,
            INavigateCommand navigateCommand,
            ReparseCommand reparseCommand,
            IClipboardWriter clipboard,
            IGeneralConfigService configService,
            ISettingsFormFactory settingsFormFactory,
            IUiDispatcher uiDispatcher)
        {
            _state               = state;
            _inspector           = inspector;
            _quickFixProvider    = quickFixProvider;
            NavigateCommand      = navigateCommand;
            _clipboard           = clipboard;
            _configService       = configService;
            _settingsFormFactory = settingsFormFactory;
            _uiDispatcher        = uiDispatcher;

            RefreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(),
                                                 o =>
            {
                IsRefreshing = true;
                IsBusy       = true;
                reparseCommand.Execute(o);
            },
                                                 o => !IsBusy && reparseCommand.CanExecute(o));

            DisableInspectionCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteDisableInspectionCommand);
            QuickFixCommand              = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            QuickFixInProcedureCommand   = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProcedureCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            QuickFixInModuleCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            QuickFixInProjectCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            QuickFixInAllProjectsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInAllProjectsCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            CopyResultsCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);
            OpenInspectionSettings       = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);

            _configService.SettingsChanged += _configService_SettingsChanged;

            // todo: remove I/O work in constructor
            _runInspectionsOnReparse = _configService.LoadConfiguration().UserSettings.CodeInspectionSettings.RunInspectionsOnSuccessfulParse;

            SetInspectionTypeGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByInspectionType = (bool)param;
                GroupByLocation       = !(bool)param;
            });

            SetLocationGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByLocation       = (bool)param;
                GroupByInspectionType = !(bool)param;
            });

            _state.StateChanged += HandleStateChanged;

            BindingOperations.CollectionRegistering += BindingOperations_CollectionRegistering;
        }
        public CodeExplorerViewModel(RubberduckParserState state, INavigateCommand navigateCommand)
        {
            _state = state;
            _navigateCommand = navigateCommand;
            _state.StateChanged += ParserState_StateChanged;
            _state.ModuleStateChanged += ParserState_ModuleStateChanged;

            _refreshCommand = new DelegateCommand(ExecuteRefreshCommand);
        }
예제 #7
0
 public FindAllImplementationsCommand(INavigateCommand navigateCommand, IMessageBox messageBox, RubberduckParserState state, VBE vbe, ISearchResultsWindowViewModel viewModel, SearchResultPresenterInstanceManager presenterService)
 {
     _navigateCommand  = navigateCommand;
     _messageBox       = messageBox;
     _state            = state;
     _vbe              = vbe;
     _viewModel        = viewModel;
     _presenterService = presenterService;
 }
예제 #8
0
        public OpenCommand(
            INavigateCommand openCommand,
            IVbeEvents vbeEvents)
            : base(vbeEvents)
        {
            _openCommand = openCommand;

            AddToCanExecuteEvaluation(SpecialEvaluateCanExecute);
        }
 public FindAllReferencesCommand(INavigateCommand navigateCommand, IMessageBox messageBox, RubberduckParserState state, VBE vbe, ISearchResultsWindowViewModel viewModel, SearchResultPresenterInstanceManager presenterService)
 {
     _navigateCommand = navigateCommand;
     _messageBox = messageBox;
     _state = state;
     _vbe = vbe;
     _viewModel = viewModel;
     _presenterService = presenterService;
 }
예제 #10
0
        public CodeExplorerViewModel(RubberduckParserState state, INavigateCommand navigateCommand)
        {
            _state                     = state;
            _navigateCommand           = navigateCommand;
            _state.StateChanged       += ParserState_StateChanged;
            _state.ModuleStateChanged += ParserState_ModuleStateChanged;

            _refreshCommand = new DelegateCommand(ExecuteRefreshCommand);
        }
예제 #11
0
        public ToDoExplorerViewModel(
            RubberduckParserState state,
            IConfigurationService <Configuration> configService,
            ISettingsFormFactory settingsFormFactory,
            IUiDispatcher uiDispatcher,
            INavigateCommand navigateCommand)
        {
            _state               = state;
            _configService       = configService;
            _settingsFormFactory = settingsFormFactory;
            _uiDispatcher        = uiDispatcher;
            _state.StateChanged += HandleStateChanged;

            NavigateCommand = navigateCommand;
            RefreshCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(),
                                                  _ =>
            {
                switch (_state.Status)
                {
                case ParserState.Ready:
                case ParserState.Error:
                case ParserState.ResolverError:
                case ParserState.UnexpectedError:
                case ParserState.Pending:
                    _state.OnParseRequested(this);
                    break;
                }
            },
                                                  _ =>
            {
                switch (_state.Status)
                {
                case ParserState.Ready:
                case ParserState.Error:
                case ParserState.ResolverError:
                case ParserState.UnexpectedError:
                case ParserState.Pending:
                    return(true);

                default:
                    return(false);
                }
            });
            RemoveCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRemoveCommand, CanExecuteRemoveCommand);
            CollapseAllCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCollapseAll);
            ExpandAllCommand        = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteExpandAll);
            CopyResultsCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);
            OpenTodoSettingsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteOpenTodoSettingsCommand);

            Items = CollectionViewSource.GetDefaultView(_items);
            OnPropertyChanged(nameof(Items));
            Grouping = ToDoItemGrouping.Marker;

            _columnHeaders = _configService.Read().UserSettings.ToDoListSettings.ColumnHeadersInformation;
        }
예제 #12
0
        public FindAllReferencesService(INavigateCommand navigateCommand, IMessageBox messageBox,
                                        RubberduckParserState state, ISearchResultsWindowViewModel viewModel,
                                        SearchResultPresenterInstanceManager presenterService, IUiDispatcher uiDispatcher)
        {
            _navigateCommand  = navigateCommand;
            _messageBox       = messageBox;
            _state            = state;
            _viewModel        = viewModel;
            _presenterService = presenterService;
            _uiDispatcher     = uiDispatcher;

            _state.StateChanged += _state_StateChanged;
        }
예제 #13
0
        public IndentCommand(
            RubberduckParserState state,
            IIndenter indenter,
            INavigateCommand navigateCommand,
            IVbeEvents vbeEvents)
            : base(vbeEvents)
        {
            _state           = state;
            _indenter        = indenter;
            _navigateCommand = navigateCommand;

            AddToCanExecuteEvaluation(SpecialEvaluateCanExecute);
        }
        public ShowParserErrorsCommand(INavigateCommand navigateCommand,
                                       RubberduckParserState state,
                                       ISearchResultsWindowViewModel viewModel,
                                       SearchResultPresenterInstanceManager presenterService)
            : base(LogManager.GetCurrentClassLogger())
        {
            _navigateCommand  = navigateCommand;
            _state            = state;
            _viewModel        = viewModel;
            _presenterService = presenterService;

            _state.StateChanged += _state_StateChanged;
        }
예제 #15
0
 public SearchResultsViewModel(INavigateCommand navigateCommand, string header, Declaration target, IEnumerable <SearchResultItem> searchResults)
 {
     _navigateCommand            = navigateCommand;
     _header                     = header;
     _target                     = target;
     _searchResults              = new ObservableCollection <SearchResultItem>(searchResults);
     _searchResultsSource        = new CollectionViewSource();
     _searchResultsSource.Source = _searchResults;
     _searchResultsSource.GroupDescriptions.Add(new PropertyGroupDescription("ParentScope.QualifiedName.QualifiedModuleName.Name"));
     _searchResultsSource.SortDescriptions.Add(new SortDescription("ParentScope.QualifiedName.QualifiedModuleName.Name", ListSortDirection.Ascending));
     _searchResultsSource.SortDescriptions.Add(new SortDescription("Selection.StartLine", ListSortDirection.Ascending));
     _searchResultsSource.SortDescriptions.Add(new SortDescription("Selection.StartColumn", ListSortDirection.Ascending));
     _closeCommand = new DelegateCommand(ExecuteCloseCommand);
 }
 public SearchResultsViewModel(INavigateCommand navigateCommand, string header, Declaration target, IEnumerable<SearchResultItem> searchResults)
 {
     _navigateCommand = navigateCommand;
     _header = header;
     _target = target;
     _searchResults = new ObservableCollection<SearchResultItem>(searchResults);
     _searchResultsSource = new CollectionViewSource();
     _searchResultsSource.Source = _searchResults;
     _searchResultsSource.GroupDescriptions.Add(new PropertyGroupDescription("ParentScope.QualifiedName.QualifiedModuleName.Name"));
     _searchResultsSource.SortDescriptions.Add(new SortDescription("ParentScope.QualifiedName.QualifiedModuleName.Name", ListSortDirection.Ascending));
     _searchResultsSource.SortDescriptions.Add(new SortDescription("Selection.StartLine", ListSortDirection.Ascending));
     _searchResultsSource.SortDescriptions.Add(new SortDescription("Selection.StartColumn", ListSortDirection.Ascending));
     _closeCommand = new DelegateCommand(ExecuteCloseCommand);
 }
예제 #17
0
        public FindAllReferencesCommand(INavigateCommand navigateCommand, IMessageBox messageBox,
                                        RubberduckParserState state, IVBE vbe, ISearchResultsWindowViewModel viewModel,
                                        SearchResultPresenterInstanceManager presenterService)
            : base(LogManager.GetCurrentClassLogger())
        {
            _navigateCommand  = navigateCommand;
            _messageBox       = messageBox;
            _state            = state;
            _vbe              = vbe;
            _viewModel        = viewModel;
            _presenterService = presenterService;

            _state.StateChanged += _state_StateChanged;
        }
        public ShowParserErrorsCommand(
            INavigateCommand navigateCommand,
            RubberduckParserState state,
            ISearchResultsWindowViewModel viewModel,
            SearchResultPresenterInstanceManager presenterService,
            IUiDispatcher uiDispatcher,
            IVbeEvents vbeEvents)
            : base(vbeEvents)
        {
            _navigateCommand  = navigateCommand;
            _state            = state;
            _viewModel        = viewModel;
            _presenterService = presenterService;
            _uiDispatcher     = uiDispatcher;

            _state.StateChanged += _state_StateChanged;
        }
        public InspectionResultsViewModel(RubberduckParserState state, IInspector inspector,
                                          INavigateCommand navigateCommand, ReparseCommand reparseCommand,
                                          IClipboardWriter clipboard, IGeneralConfigService configService, IOperatingSystem operatingSystem)
        {
            _state           = state;
            _inspector       = inspector;
            _navigateCommand = navigateCommand;
            _clipboard       = clipboard;
            _configService   = configService;
            _operatingSystem = operatingSystem;
            _refreshCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(),
                                                   o => {
                IsBusy = true;
                reparseCommand.Execute(o);
            },
                                                   o => !IsBusy && reparseCommand.CanExecute(o));

            _disableInspectionCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteDisableInspectionCommand);
            _quickFixCommand          = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            _quickFixInModuleCommand  = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            _quickFixInProjectCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            _copyResultsCommand       = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);
            _openSettingsCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);

            _configService.SettingsChanged += _configService_SettingsChanged;

            // todo: remove I/O work in constructor
            _runInspectionsOnReparse = _configService.LoadConfiguration().UserSettings.CodeInspectionSettings.RunInspectionsOnSuccessfulParse;

            _setInspectionTypeGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByInspectionType = (bool)param;
                GroupByLocation       = !(bool)param;
            });

            _setLocationGroupingCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), param =>
            {
                GroupByLocation       = (bool)param;
                GroupByInspectionType = !(bool)param;
            });

            _state.StateChanged += _state_StateChanged;
        }
        public InspectionResultsViewModel(RubberduckParserState state, IInspector inspector, VBE vbe, INavigateCommand navigateCommand, IClipboardWriter clipboard, IGeneralConfigService configService)
        {
            _dispatcher = Dispatcher.CurrentDispatcher;

            _state = state;
            _inspector = inspector;
            _vbe = vbe;
            _navigateCommand = navigateCommand;
            _clipboard = clipboard;
            _configService = configService;
            _refreshCommand = new DelegateCommand(async param => await Task.Run(() => ExecuteRefreshCommandAsync(param)), CanExecuteRefreshCommand);
            _disableInspectionCommand = new DelegateCommand(ExecuteDisableInspectionCommand);
            _quickFixCommand = new DelegateCommand(ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            _quickFixInModuleCommand = new DelegateCommand(ExecuteQuickFixInModuleCommand);
            _quickFixInProjectCommand = new DelegateCommand(ExecuteQuickFixInProjectCommand);
            _copyResultsCommand = new DelegateCommand(ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);

            _state.StateChanged += _state_StateChanged;
        }
예제 #21
0
        public InspectionResultsViewModel(RubberduckParserState state, IInspector inspector, VBE vbe, INavigateCommand navigateCommand, IClipboardWriter clipboard, IGeneralConfigService configService)
        {
            _dispatcher = Dispatcher.CurrentDispatcher;

            _state                    = state;
            _inspector                = inspector;
            _vbe                      = vbe;
            _navigateCommand          = navigateCommand;
            _clipboard                = clipboard;
            _configService            = configService;
            _refreshCommand           = new DelegateCommand(async param => await Task.Run(() => ExecuteRefreshCommandAsync(param)), CanExecuteRefreshCommand);
            _disableInspectionCommand = new DelegateCommand(ExecuteDisableInspectionCommand);
            _quickFixCommand          = new DelegateCommand(ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            _quickFixInModuleCommand  = new DelegateCommand(ExecuteQuickFixInModuleCommand);
            _quickFixInProjectCommand = new DelegateCommand(ExecuteQuickFixInProjectCommand);
            _copyResultsCommand       = new DelegateCommand(ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);

            _state.StateChanged += _state_StateChanged;
        }
 public CodeExplorer_NavigateCommand(INavigateCommand navigateCommand)
 {
     _navigateCommand = navigateCommand;
 }
예제 #23
0
        public InspectionResultsViewModel(
            RubberduckParserState state,
            IInspector inspector,
            IQuickFixProvider quickFixProvider,
            INavigateCommand navigateCommand,
            ReparseCommand reparseCommand,
            IClipboardWriter clipboard,
            IWebNavigator web,
            IConfigurationService <Configuration> configService,
            ISettingsFormFactory settingsFormFactory,
            IUiDispatcher uiDispatcher)
        {
            _web                 = web;
            _state               = state;
            _inspector           = inspector;
            _quickFixProvider    = quickFixProvider;
            NavigateCommand      = navigateCommand;
            _clipboard           = clipboard;
            _configService       = configService;
            _settingsFormFactory = settingsFormFactory;
            _uiDispatcher        = uiDispatcher;

            RefreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(),
                                                 o =>
            {
                IsBusy = true;
                _forceRefreshResults = true;
                var cancellation     = new ReparseCancellationFlag();
                reparseCommand.Execute(cancellation);
                if (cancellation.Canceled)
                {
                    IsBusy = false;
                }
            },
                                                 o => !IsBusy && reparseCommand.CanExecute(o));

            DisableInspectionCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteDisableInspectionCommand);
            QuickFixCommand              = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            QuickFixSelectedItemsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixForSelection, CanExecuteQuickFixForSelection);
            QuickFixInProcedureCommand   = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProcedureCommand, CanExecuteQuickFixInProcedure);
            QuickFixInModuleCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand, CanExecuteQuickFixInModule);
            QuickFixInProjectCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand, CanExecuteQuickFixInProject);
            QuickFixInAllProjectsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInAllProjectsCommand, CanExecuteQuickFixAll);
            CopyResultsCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);
            OpenInspectionSettings       = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);
            CollapseAllCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCollapseAll);
            ExpandAllCommand             = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteExpandAll);

            OpenInspectionDetailsPageCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteOpenInspectionDetailsPageCommand);

            QuickFixCommands = new List <(ICommand command, string key, Func <IQuickFix, bool> visibility)>
            {
                (QuickFixCommand, "QuickFix_Instance", quickFix => true),
                (QuickFixSelectedItemsCommand, "QuickFix_Selection", quickFix => quickFix.CanFixMultiple),
                (QuickFixInProcedureCommand, "QuickFix_ThisProcedure", quickFix => quickFix.CanFixInProcedure),
                (QuickFixInModuleCommand, "QuickFix_ThisModule", quickFix => quickFix.CanFixInModule),
                (QuickFixInProjectCommand, "QuickFix_ThisProject", quickFix => quickFix.CanFixInProject),
                (QuickFixInAllProjectsCommand, "QuickFix_All", quickFix => quickFix.CanFixAll)
            };

            _configService.SettingsChanged += _configService_SettingsChanged;

            // todo: remove I/O work in constructor
            _runInspectionsOnReparse = _configService.Read().UserSettings.CodeInspectionSettings.RunInspectionsOnSuccessfulParse;

            if (CollectionViewSource.GetDefaultView(_results) is ListCollectionView results)
            {
                results.Filter     = inspection => InspectionFilter((IInspectionResult)inspection);
                results.CustomSort = this;
                Results            = results;
            }

            OnPropertyChanged(nameof(Results));
            Grouping = InspectionResultGrouping.Type;

            _state.StateChanged += HandleStateChanged;
        }
예제 #24
0
 private static FindAllImplementationsService ArrangeFindAllImplementationsService(RubberduckParserState state,
                                                                                   ISearchResultsWindowViewModel viewModel, INavigateCommand navigateCommand = null, IMessageBox messageBox = null,
                                                                                   SearchResultPresenterInstanceManager presenterService = null, IUiDispatcher uiDispatcher = null)
 {
     return(new FindAllImplementationsService(
                navigateCommand ?? new Mock <INavigateCommand>().Object,
                messageBox ?? new Mock <IMessageBox>().Object,
                state,
                viewModel,
                presenterService,
                uiDispatcher ?? new Mock <IUiDispatcher>().Object));
 }
예제 #25
0
 public static void Go <T>(this INavigateCommand This, string key = null)
     where T : IRoutableViewModel
 {
     This.Execute(RxApp.GetService <T>(key));
 }
예제 #26
0
 public OpenCommand(INavigateCommand openCommand)
 {
     _openCommand = openCommand;
 }
 public CodeExplorer_IndentCommand(RubberduckParserState state, IIndenter indenter, INavigateCommand navigateCommand)
 {
     _state           = state;
     _indenter        = indenter;
     _navigateCommand = navigateCommand;
 }
예제 #28
0
        public InspectionResultsViewModel(
            RubberduckParserState state,
            IInspector inspector,
            IQuickFixProvider quickFixProvider,
            INavigateCommand navigateCommand,
            ReparseCommand reparseCommand,
            IClipboardWriter clipboard,
            IGeneralConfigService configService,
            ISettingsFormFactory settingsFormFactory,
            IUiDispatcher uiDispatcher)
        {
            _state               = state;
            _inspector           = inspector;
            _quickFixProvider    = quickFixProvider;
            NavigateCommand      = navigateCommand;
            _clipboard           = clipboard;
            _configService       = configService;
            _settingsFormFactory = settingsFormFactory;
            _uiDispatcher        = uiDispatcher;

            RefreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(),
                                                 o =>
            {
                IsRefreshing     = true;
                IsBusy           = true;
                var cancellation = new ReparseCancellationFlag();
                reparseCommand.Execute(cancellation);
                if (cancellation.Canceled)
                {
                    IsBusy = false;
                }
            },
                                                 o => !IsBusy && reparseCommand.CanExecute(o));

            DisableInspectionCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteDisableInspectionCommand);
            QuickFixCommand              = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixCommand, CanExecuteQuickFixCommand);
            QuickFixInProcedureCommand   = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProcedureCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            QuickFixInModuleCommand      = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInModuleCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            QuickFixInProjectCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInProjectCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            QuickFixInAllProjectsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteQuickFixInAllProjectsCommand, _ => SelectedItem != null && _state.Status == ParserState.Ready);
            CopyResultsCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand, CanExecuteCopyResultsCommand);
            OpenInspectionSettings       = new DelegateCommand(LogManager.GetCurrentClassLogger(), OpenSettings);
            CollapseAllCommand           = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCollapseAll);
            ExpandAllCommand             = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteExpandAll);

            _configService.SettingsChanged += _configService_SettingsChanged;

            // todo: remove I/O work in constructor
            _runInspectionsOnReparse = _configService.LoadConfiguration().UserSettings.CodeInspectionSettings.RunInspectionsOnSuccessfulParse;

            if (CollectionViewSource.GetDefaultView(_results) is ListCollectionView results)
            {
                results.Filter     = inspection => InspectionFilter((IInspectionResult)inspection);
                results.CustomSort = this;
                Results            = results;
            }

            OnPropertyChanged(nameof(Results));
            Grouping = InspectionResultGrouping.Type;

            _state.StateChanged += HandleStateChanged;
        }
예제 #29
0
 public NavigateCommand(INavigateCommand navigateCommand) : base(LogManager.GetCurrentClassLogger())
 {
     _navigateCommand = navigateCommand;
 }
예제 #30
0
 public IndentCommand(RubberduckParserState state, IIndenter indenter, INavigateCommand navigateCommand) : base(LogManager.GetCurrentClassLogger())
 {
     _state           = state;
     _indenter        = indenter;
     _navigateCommand = navigateCommand;
 }
예제 #31
0
 public OpenCommand(INavigateCommand OpenCommand) : base(LogManager.GetCurrentClassLogger())
 {
     _openCommand = OpenCommand;
 }