Exemple #1
0
        public void SearchResults(SyncList <MatchResultVw> lResultsToSync, DelegateFilterResults dfr)
        {
            CheckTime ct = new CheckTime("SearchResults() entered");

            lock (m_oReadLocker)
            {
                ct.AddEvent("Inside of lock");

                if (lResultsToSync != null)
                {
                    HashSet <MatchResultVw> hsMatches = new HashSet <MatchResultVw>();

                    SyncList <MatchResultLn> lAllResults = m_diAll.MatchResults.ToSyncList();

                    foreach (MatchResultLn result in lAllResults)
                    {
                        if (dfr == null || dfr(result))
                        {
                            hsMatches.Add(result.MatchResultView);

                            if (!lResultsToSync.Contains(result.MatchResultView))
                            {
                                lResultsToSync.Add(result.MatchResultView);
                            }
                        }
                    }

                    for (int i = 0; i < lResultsToSync.Count;)
                    {
                        MatchResultVw matchResultView = lResultsToSync[i];

                        if (!hsMatches.Contains(matchResultView))
                        {
                            lResultsToSync.RemoveAt(i);
                        }
                        else
                        {
                            i++;
                        }
                    }
                }
            }

            ct.AddEvent("Completed");
            ct.Info(m_logger);
        }
Exemple #2
0
        public void SearchResults(SortableObservableCollection <MatchResultVw> ocMatchResults, DelegateFilterResults dfr, Comparison <MatchResultVw> comparison)
        {
            SyncList <MatchResultVw> lResultsToSync = ocMatchResults.ToSyncList();

            SearchResults(lResultsToSync, dfr);

            if (comparison != null)
            {
                lResultsToSync.Sort(comparison);
                ocMatchResults.ApplyChanges(lResultsToSync);
            }
        }