Beispiel #1
0
        internal void RecalculateResults(EditingContext context, ModelSearchResults modelSearchResults)
        {
            // reset all old IsInSearchResults values
            foreach (var oldSearchResult in Results)
            {
                oldSearchResult.IsInSearchResults = false;
            }

            // now recalculate the results based on the new ModelSearchResults
            Reset();
            _targetString        = modelSearchResults.TargetString;
            _elementTextToSearch = modelSearchResults.ElementTextToSearch;
            var modelToExplorerModelXRef = ModelToExplorerModelXRef.GetModelToBrowserModelXRef(context);

            if (null != modelToExplorerModelXRef)
            {
                // add all the ExplorerEFElements to _results
                foreach (var result in modelSearchResults.Results)
                {
                    var resultsExplorerElement = modelToExplorerModelXRef.GetExisting(result);
                    if (resultsExplorerElement != null)
                    {
                        resultsExplorerElement.IsInSearchResults = true;
                        _results.Add(resultsExplorerElement);
                    }
                }

                // now sort _results according to the order they appear in the Explorer
                SortResults();
            }
        }
        internal void RecalculateResults(EditingContext context, ModelSearchResults modelSearchResults)
        {
            // reset all old IsInSearchResults values
            foreach (var oldSearchResult in Results)
            {
                oldSearchResult.IsInSearchResults = false;
            }

            // now recalculate the results based on the new ModelSearchResults
            Reset();
            _targetString = modelSearchResults.TargetString;
            _elementTextToSearch = modelSearchResults.ElementTextToSearch;
            var modelToExplorerModelXRef = ModelToExplorerModelXRef.GetModelToBrowserModelXRef(context);
            if (null != modelToExplorerModelXRef)
            {
                // add all the ExplorerEFElements to _results
                foreach (var result in modelSearchResults.Results)
                {
                    var resultsExplorerElement = modelToExplorerModelXRef.GetExisting(result);
                    if (resultsExplorerElement != null)
                    {
                        resultsExplorerElement.IsInSearchResults = true;
                        _results.Add(resultsExplorerElement);
                    }
                }

                // now sort _results according to the order they appear in the Explorer
                SortResults();
            }
        }
Beispiel #3
0
        // Must have public constructor to allow creation by reflection
        // in EditingContext.GetValue()

        internal void Reset()
        {
            if (null != _results)
            {
                foreach (var explorerElement in _results)
                {
                    explorerElement.IsInSearchResults = false;
                }
                _results.Clear();
            }
            _previousSearchResultItem      = null;
            _previousSearchResultItemIndex = -1;
            _nextSearchResultItem          = null;
            _nextSearchResultItemIndex     = -1;
            _currentSelectionIsInResults   = false;
            _targetString        = null;
            _elementTextToSearch = null;
        }
        // Must have public constructor to allow creation by reflection 
        // in EditingContext.GetValue()

        internal void Reset()
        {
            if (null != _results)
            {
                foreach (var explorerElement in _results)
                {
                    explorerElement.IsInSearchResults = false;
                }
                _results.Clear();
            }
            _previousSearchResultItem = null;
            _previousSearchResultItemIndex = -1;
            _nextSearchResultItem = null;
            _nextSearchResultItemIndex = -1;
            _currentSelectionIsInResults = false;
            _targetString = null;
            _elementTextToSearch = null;
        }