Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QuickFindCommandItem"/> class.
        /// </summary>
        /// <param name="searchExtension">The search extension.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="searchExtension"/> is <see langword="null"/>.
        /// </exception>
        public QuickFindCommandItem(SearchExtension searchExtension)
        {
            if (searchExtension == null)
            {
                throw new ArgumentNullException(nameof(searchExtension));
            }

            SearchExtension = searchExtension;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FindAndReplaceViewModel"/> class.
        /// </summary>
        /// <param name="searchExtension">
        /// The search extension. Can be <see langword="null"/> at design-time.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="searchExtension"/> is <see langword="null"/>.
        /// </exception>
        public FindAndReplaceViewModel(SearchExtension searchExtension)
        {
            DisplayName  = "Find & Replace";
            DockId       = DockIdString;
            IsPersistent = true;
            DockWidth    = new GridLength(200);
            DockHeight   = new GridLength(1, GridUnitType.Auto);
            //Icon = MultiColorGlyphs.Find;

            if (!WindowsHelper.IsInDesignMode)
            {
                if (searchExtension == null)
                {
                    throw new ArgumentNullException(nameof(searchExtension));
                }

                _searchExtension = searchExtension;

                if (Query.Mode == SearchMode.Normal)
                {
                    _useRegexOrWildcards = false;
                    _regexOrWildcards    = SearchMode.Regex;
                }
                else
                {
                    _useRegexOrWildcards = true;
                    _regexOrWildcards    = Query.Mode;
                }

                Query.PropertyChanged += OnQueryChanged;

                FindPreviousCommand = ((CommandItem)searchExtension.CommandItems["FindPrevious"]).Command;
                FindNextCommand     = ((CommandItem)searchExtension.CommandItems["FindNext"]).Command;
                ReplaceCommand      = ((CommandItem)searchExtension.CommandItems["Replace"]).Command;
                ReplaceAllCommand   = ((CommandItem)searchExtension.CommandItems["ReplaceAll"]).Command;
                CancelCommand       = new DelegateCommand(Cancel);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SearchScopeCollection"/> class.
 /// </summary>
 /// <param name="searchExtension">The search extension.</param>
 public SearchScopeCollection(SearchExtension searchExtension)
 {
     _searchExtension = searchExtension;
 }