Пример #1
0
        public CodeSearchControl()
        {
            InitializeComponent();
            // Add the "VsColors" brushes to the WPF resources of the control, so that the
            // resource keys used on the XAML file can be resolved dynamically.
            Resources.MergedDictionaries.Add(VsResources.BuildResourceDictionary());
            DataContext = new CodeSearchViewModel();

            _progressBarTracker = new ProgressBarTracker(ProgressBar);

            InitComboBox(SearchCodeCombo, new ComboBoxInfo {
                TextChanged    = text => { ViewModel.SearchCodeValue = text; },
                SearchFunction = RefreshSearchResults,
                NextElement    = SearchFilePathsCombo,
            });
            InitComboBox(SearchFilePathsCombo, new ComboBoxInfo {
                TextChanged     = text => { ViewModel.SearchFilePathsValue = text; },
                SearchFunction  = RefreshSearchResults,
                PreviousElement = SearchCodeCombo,
                NextElement     = FileTreeView,
                InitialItems    =
                {
                    "*",
                    "*.c;*.cpp;*.cxx;*.cc;*.tli;*.tlh;*.h;*.hh;*.hpp;*.hxx;*.hh;*.inl;*.rc;*.resx;*.idl;*.asm;*.inc",
                    "*.htm;*.html;*.xml;*.gif;*.jpg;*.png;*.css;*.disco;*.js;*.srf",
                    "*.xml;*.xsl;*.xslt;*.xsd;*.dtd",
                    "*.txt",
                    "*.cs;*.resx;*.resw;*.xsd;*.wsdl;*.xaml;*.xml;*.htm;*.html;*.css",
                    "*.vb;*.resx;*.resw;*.xsd;*.wsdl;*.xaml;*.xml;*.htm;*.html;*.css",
                    "*.*",
                }
            });
        }
Пример #2
0
    public CodeSearchControl() {
      InitializeComponent();
      // Add the "VsColors" brushes to the WPF resources of the control, so that the
      // resource keys used on the XAML file can be resolved dynamically.
      this.Resources.MergedDictionaries.Add(VsResources.BuildResourceDictionary());
      base.DataContext = new CodeSearchViewModel();

      _progressBarTracker = new ProgressBarTracker(ProgressBar);

      InitComboBox(SearchCodeCombo, new ComboBoxInfo {
        TextChanged = text => { ViewModel.SearchCodeValue = text; },
        SearchFunction = RefreshSearchResults,
        NextElement = SearchFilePathsCombo,
      });
      InitComboBox(SearchFilePathsCombo, new ComboBoxInfo {
        TextChanged = text => { ViewModel.SearchFilePathsValue = text; },
        SearchFunction = RefreshSearchResults,
        PreviousElement = SearchCodeCombo,
        NextElement = FileTreeView,
        InitialItems = {
          "*",
          "*.c;*.cpp;*.cxx;*.cc;*.tli;*.tlh;*.h;*.hh;*.hpp;*.hxx;*.hh;*.inl;*.rc;*.resx;*.idl;*.asm;*.inc",
          "*.htm;*.html;*.xml;*.gif;*.jpg;*.png;*.css;*.disco;*.js;*.srf",
          "*.xml;*.xsl;*.xslt;*.xsd;*.dtd",
          "*.txt",
          "*.cs;*.resx;*.resw;*.xsd;*.wsdl;*.xaml;*.xml;*.htm;*.html;*.css",
          "*.vb;*.resx;*.resw;*.xsd;*.wsdl;*.xaml;*.xml;*.htm;*.html;*.css",
          "*.*",
        }
      });
    }
Пример #3
0
        public CodeSearchController(
            CodeSearchControl control,
            IDispatchThreadServerRequestExecutor dispatchThreadServerRequestExecutor,
            IDispatchThreadDelayedOperationExecutor dispatchThreadDelayedOperationExecutor,
            IFileSystemTreeSource fileSystemTreeSource,
            ITypedRequestProcessProxy typedRequestProcessProxy,
            IProgressBarTracker progressBarTracker,
            IStandarImageSourceFactory standarImageSourceFactory,
            IWindowsExplorer windowsExplorer,
            IClipboard clipboard,
            ISynchronizationContextProvider synchronizationContextProvider,
            IOpenDocumentHelper openDocumentHelper,
            ITextDocumentTable textDocumentTable,
            IEventBus eventBus,
            IGlobalSettingsProvider globalSettingsProvider,
            IBuildOutputParser buildOutputParser,
            IVsEditorAdaptersFactoryService adaptersFactoryService,
            IShowServerInfoService showServerInfoService)
        {
            _control = control;
            _dispatchThreadServerRequestExecutor = dispatchThreadServerRequestExecutor;
            _fileSystemTreeSource      = fileSystemTreeSource;
            _typedRequestProcessProxy  = typedRequestProcessProxy;
            _progressBarTracker        = progressBarTracker;
            _standarImageSourceFactory = standarImageSourceFactory;
            _windowsExplorer           = windowsExplorer;
            _clipboard = clipboard;
            _synchronizationContextProvider = synchronizationContextProvider;
            _openDocumentHelper             = openDocumentHelper;
            _eventBus = eventBus;
            _globalSettingsProvider            = globalSettingsProvider;
            _buildOutputParser                 = buildOutputParser;
            _adaptersFactoryService            = adaptersFactoryService;
            _showServerInfoService             = showServerInfoService;
            _searchResultDocumentChangeTracker = new SearchResultsDocumentChangeTracker(
                dispatchThreadDelayedOperationExecutor,
                textDocumentTable);
            _taskCancellation = new TaskCancellation();

            // Ensure initial values are in sync.
            GlobalSettingsOnPropertyChanged(null, null);

            // Ensure changes to ViewModel are synchronized to global settings
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;

            // Ensure changes to global settings are synchronized to ViewModel
            _globalSettingsProvider.GlobalSettings.PropertyChanged += GlobalSettingsOnPropertyChanged;

            _eventBusCookie1 = _eventBus.RegisterHandler("TextDocument-Open", TextDocumentOpenHandler);
            _eventBusCookie2 = _eventBus.RegisterHandler("TextDocument-Closed", TextDocumentClosedHandler);
            _eventBusCookie3 = _eventBus.RegisterHandler("TextDocumentFile-FileActionOccurred", TextDocumentFileActionOccurred);

            typedRequestProcessProxy.EventReceived += TypedRequestProcessProxy_OnEventReceived;

            dispatchThreadServerRequestExecutor.ProcessFatalError += DispatchThreadServerRequestExecutor_OnProcessFatalError;

            fileSystemTreeSource.TreeReceived  += FileSystemTreeSource_OnTreeReceived;
            fileSystemTreeSource.ErrorReceived += FileSystemTreeSource_OnErrorReceived;
        }
        public CodeSearchController(
            CodeSearchControl control,
            IUIRequestProcessor uiRequestProcessor,
            IUIDelayedOperationProcessor uiDelayedOperationProcessor,
            IProgressBarTracker progressBarTracker,
            IStandarImageSourceFactory standarImageSourceFactory,
            IWindowsExplorer windowsExplorer,
            IClipboard clipboard,
            ISynchronizationContextProvider synchronizationContextProvider,
            IOpenDocumentHelper openDocumentHelper,
            ITextDocumentTable textDocumentTable,
            IEventBus eventBus,
            IGlobalSettingsProvider globalSettingsProvider,
            IBuildOutputParser buildOutputParser,
            IVsEditorAdaptersFactoryService adaptersFactoryService)
        {
            _control                           = control;
            _uiRequestProcessor                = uiRequestProcessor;
            _progressBarTracker                = progressBarTracker;
            _standarImageSourceFactory         = standarImageSourceFactory;
            _windowsExplorer                   = windowsExplorer;
            _clipboard                         = clipboard;
            _synchronizationContextProvider    = synchronizationContextProvider;
            _openDocumentHelper                = openDocumentHelper;
            _eventBus                          = eventBus;
            _globalSettingsProvider            = globalSettingsProvider;
            _buildOutputParser                 = buildOutputParser;
            _adaptersFactoryService            = adaptersFactoryService;
            _searchResultDocumentChangeTracker = new SearchResultsDocumentChangeTracker(
                uiDelayedOperationProcessor,
                textDocumentTable);
            _taskCancellation = new TaskCancellation();

            // Ensure initial values are in sync.
            GlobalSettingsOnPropertyChanged(null, null);

            // Ensure changes to ViewModel are synchronized to global settings
            ViewModel.PropertyChanged += ViewModelOnPropertyChanged;

            // Ensure changes to global settings are synchronized to ViewModel
            _globalSettingsProvider.GlobalSettings.PropertyChanged += GlobalSettingsOnPropertyChanged;

            _eventBusCookie1 = _eventBus.RegisterHandler("TextDocument-Open", TextDocumentOpenHandler);
            _eventBusCookie2 = _eventBus.RegisterHandler("TextDocument-Closed", TextDocumentClosedHandler);
            _eventBusCookie3 = _eventBus.RegisterHandler("TextDocumentFile-FileActionOccurred", TextDocumentFileActionOccurred);
        }
        public SourceExplorerControl()
        {
            InitializeComponent();

            base.DataContext = new SourceExplorerViewModel();

            _progressBarTracker = new ProgressBarTracker(ProgressBar);

            InitComboBox(FileNamesSearch, new ComboBoxInfo {
                SearchFunction = SearchFilesNames
            });
            InitComboBox(DirectoryNamesSearch, new ComboBoxInfo {
                SearchFunction = SearchDirectoryNames
            });
            InitComboBox(FileContentsSearch, new ComboBoxInfo {
                SearchFunction = SearchFileContents
            });
        }
Пример #6
0
        public CodeSearchControl()
        {
            InitializeComponent();
            // Add the "VsColors" brushes to the WPF resources of the control, so that the
            // resource keys used on the XAML file can be resolved dynamically.
            Resources.MergedDictionaries.Add(VsResources.BuildResourceDictionary());
            DataContext = new CodeSearchViewModel();

            _progressBarTracker = new ProgressBarTracker(ProgressBar);

            InitComboBox(SearchCodeCombo, new ComboBoxInfo {
                TextChanged    = text => { ViewModel.SearchCodeValue = text; },
                SearchFunction = RefreshSearchResults,
                NextElement    = SearchFilePathsCombo,
            });
            InitComboBox(SearchFilePathsCombo, new ComboBoxInfo {
                TextChanged     = text => { ViewModel.SearchFilePathsValue = text; },
                SearchFunction  = RefreshSearchResults,
                PreviousElement = SearchCodeCombo,
                InitialItems    =
                {
                    "*",
                    "*.c;*.cpp;*.cxx;*.cc;*.tli;*.tlh;*.h;*.hh;*.hpp;*.hxx;*.hh;*.inl;*.rc;*.resx;*.idl;*.asm;*.inc",
                    "*.htm;*.html;*.xml;*.gif;*.jpg;*.png;*.css;*.disco;*.js;*.srf",
                    "*.xml;*.xsl;*.xslt;*.xsd;*.dtd",
                    "*.txt",
                    "*.cs;*.resx;*.resw;*.xsd;*.wsdl;*.xaml;*.xml;*.htm;*.html;*.css",
                    "*.vb;*.resx;*.resw;*.xsd;*.wsdl;*.xaml;*.xml;*.htm;*.html;*.css",
                    "*.*",
                }
            });

            // Setup custom NextElement logic to account for swapping tree/list views
            SearchFilePathsCombo.PrePreviewKeyDown += (s, e) => {
                if (e.KeyboardDevice.Modifiers == ModifierKeys.None && e.Key == Key.Down)
                {
                    if (!SearchFilePathsCombo.IsDropDownOpen)
                    {
                        if (ViewModel.FlattenSearchResults)
                        {
                            FileListBox.Focus();

                            if (FileListBox.SelectedItem == null)
                            {
                                FileListBox.SelectedIndex = 0;
                            }

                            var listBoxItem = (ListBoxItem)FileListBox.ItemContainerGenerator.ContainerFromItem(FileListBox.SelectedItem);
                            if (listBoxItem != null)
                            {
                                listBoxItem.Focus();
                            }
                        }
                        else
                        {
                            FileTreeView.Focus();
                        }
                        e.Handled = true;
                    }
                }
            };
        }