예제 #1
0
        public AboutControlViewModel(IVersionCheck version, IWebNavigator web)
        {
            _version = version;
            _web     = web;

            UriCommand     = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteUri);
            ViewLogCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteViewLog);
        }
            /// <summary>
            /// Initializes the new match instance.
            /// </summary>
            /// <param name="control">the matching control. Must not be null!</param>
            public NavigableControlInfo( Control control )
            {
                AssertUtils.ArgumentNotNull(control, "control");

                Control = control;

                if (Control is IWebNavigable)
                {
                    WebNavigator = ((IWebNavigable)Control).WebNavigator;
                }
                else if (Control is IWebNavigator)
                {
                    WebNavigator = (IWebNavigator)control;
                }
            }
예제 #3
0
            /// <summary>
            /// Initializes the new match instance.
            /// </summary>
            /// <param name="control">the matching control. Must not be null!</param>
            public NavigableControlInfo(Control control)
            {
                AssertUtils.ArgumentNotNull(control, "control");

                Control = control;

                if (Control is IWebNavigable)
                {
                    WebNavigator = ((IWebNavigable)Control).WebNavigator;
                }
                else if (Control is IWebNavigator)
                {
                    WebNavigator = (IWebNavigator)control;
                }
            }
예제 #4
0
 /// <summary>
 /// Ensure, that <see cref="WebNavigator"/> is set to a valid instance.
 /// </summary>
 /// <remarks>
 /// If <see cref="WebNavigator"/> is not already set, creates and sets a new <see cref="WebFormsResultWebNavigator"/> instance.<br/>
 /// Override this method if you don't want to inject a navigator, but need a different default.
 /// </remarks>
 protected virtual void InitializeNavigationSupport()
 {
     webNavigator = new WebFormsResultWebNavigator(this, null, null, true);
 }
예제 #5
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;
        }
 /// <summary>
 /// Creates a new instance of a <see cref="IHierarchicalWebNavigator"/> for the specified control.
 /// </summary>
 /// <param name="owner">the control to be associated with this navigator.</param>
 /// <param name="parent">the direct parent of this navigator</param>
 /// <param name="initialResults">a dictionary containing results</param>
 /// <param name="ignoreCase">specifies how to handle case for destination names.</param>
 public WebFormsResultWebNavigator( Control owner, IWebNavigator parent, IDictionary initialResults, bool ignoreCase )
     : base( parent, initialResults, ignoreCase )
 {
     AssertUtils.ArgumentNotNull( owner, "owner" );
     _owner = owner;
 }
예제 #7
0
 /// <summary>
 /// Creates a new instance of a <see cref="IHierarchicalWebNavigator"/> for the specified control.
 /// </summary>
 /// <param name="owner">the control to be associated with this navigator.</param>
 /// <param name="parent">the direct parent of this navigator</param>
 /// <param name="initialResults">a dictionary containing results</param>
 /// <param name="ignoreCase">specifies how to handle case for destination names.</param>
 public WebFormsResultWebNavigator(Control owner, IWebNavigator parent, IDictionary initialResults, bool ignoreCase)
     : base(parent, initialResults, ignoreCase)
 {
     AssertUtils.ArgumentNotNull(owner, "owner");
     _owner = owner;
 }
예제 #8
0
 /// <summary>
 /// Create a new adapter instance, wrapping the specified <paramref name="resultNavigator"/>
 /// into a <see cref="IWebNavigable"/> interface.
 /// </summary>
 /// <param name="resultNavigator">the <see cref="IWebNavigator"/> instance to be adapted. May be null.</param>
 public WebNavigableWebNavigatorAdapter(IWebNavigator resultNavigator)
 {
     _resultNavigator = resultNavigator;
 }
 /// <summary>
 /// Creates and initializes a new instance.
 /// </summary>
 /// <param name="parent">the parent of this instance. May be null.</param>
 /// <param name="initialResults">a dictionary of result name to result mappings. May be null.</param>
 /// <param name="ignoreCase">sets, how this navigator treats case sensitivity of result names</param>
 public DefaultResultWebNavigator(IWebNavigator parent, IDictionary initialResults, bool ignoreCase)
 {
     this._parentNavigator = parent;
     this._ignoreCase      = ignoreCase;
     this._results         = CreateResultsDictionary(initialResults);
 }
예제 #10
0
 public AboutCommand(IVersionCheck versionService, IWebNavigator web)
 {
     _versionService = versionService;
     _web            = web;
 }
예제 #11
0
 public AboutDialog(IVersionCheck versionCheck, IWebNavigator web) : this()
 {
     ViewModel = new AboutControlViewModel(versionCheck, web);
 }
예제 #12
0
 /// <summary>
 /// Ensure, that <see cref="WebNavigator"/> is set to a valid instance.
 /// </summary>
 /// <remarks>
 /// If <see cref="WebNavigator"/> is not already set, creates and sets a new <see cref="WebFormsResultWebNavigator"/> instance.<br/>
 /// Override this method if you don't want to inject a navigator, but need a different default.
 /// </remarks>
 protected virtual void InitializeNavigationSupport()
 {
     webNavigator = new WebFormsResultWebNavigator(this, null, null, true);
 }
 /// <summary>
 /// Creates and initializes a new instance.
 /// </summary>
 /// <param name="parent">the parent of this instance. May be null.</param>
 /// <param name="initialResults">a dictionary of result name to result mappings. May be null.</param>
 /// <param name="ignoreCase">sets, how this navigator treats case sensitivity of result names</param>
 public DefaultResultWebNavigator( IWebNavigator parent, IDictionary initialResults, bool ignoreCase )
 {
     this._parentNavigator = parent;
     this._ignoreCase = ignoreCase;
     this._results = CreateResultsDictionary( initialResults );
 }
 /// <summary>
 /// Create a new adapter instance, wrapping the specified <paramref name="resultNavigator"/> 
 /// into a <see cref="IWebNavigable"/> interface.
 /// </summary>
 /// <param name="resultNavigator">the <see cref="IWebNavigator"/> instance to be adapted. May be null.</param>
 public WebNavigableWebNavigatorAdapter(IWebNavigator resultNavigator)
 {
     _resultNavigator = resultNavigator;
 }