Exemple #1
0
 private void SearchService_OnCompletDicomFile(object sender, Services.EventArgs.OnCompleteDicomFileEventArgs e)
 {
     lock (obj2)
     {
         if (e.IsMatched)
         {
             App.Current.Dispatcher.Invoke(() => MatchedFileList.Add(e.ResultDicomFile));
             MatchedFileCount = e.MatchedFileCount;
         }
         SearchedFileCount = e.SearchedFileCount;
     }
 }
Exemple #2
0
        private void DoSearch(bool searchInResults = false)
        {
            SearchCriteria criteria = new SearchCriteria
            {
                SearchPath        = SearchPath,
                FileTypes         = FileTypes,
                SearchSopClassUid = SopClassUid,
                SearchTag         = Tag,
                SearchText        = SearchText,
                CaseSensitive     = CaseSensitive,
                WholeWord         = WholeWord,
                IncludeSubfolders = IncludeSubfolders,
                SearchInResults   = searchInResults, // from parameter
                SearchThreads     = SearchThreads
            };

            Util.PushToList(SearchPath, SearchPathHistory, CurrentConfiguration.HistoryCapacity);
            Util.PushToList(FileTypes, FileTypesHistory, CurrentConfiguration.HistoryCapacity);
            Util.PushToList(SopClassUid, SopClassUidHistory, CurrentConfiguration.HistoryCapacity);
            Util.PushToList(Tag, DicomTagHistory, CurrentConfiguration.HistoryCapacity);
            Util.PushToList(SearchText, SearchTextHistory, CurrentConfiguration.HistoryCapacity);

            CurrentConfiguration.SearchCriteria     = criteria;
            CurrentConfiguration.SearchPathHistory  = new List <string>(SearchPathHistory);
            CurrentConfiguration.FileTypesHistory   = new List <string>(FileTypesHistory);
            CurrentConfiguration.SopClassUidHistory = new List <string>(SopClassUidHistory);
            CurrentConfiguration.DicomTagHistory    = new List <string>(DicomTagHistory);
            CurrentConfiguration.SearchTextHistory  = new List <string>(SearchTextHistory);

            configurationService.Save();

            MatchedFileList.Clear();
            SelectedMatchedFile = null;

            this.TotalFileCount    = 0;
            this.SearchedFileCount = 0;
            this.MatchedFileCount  = 0;

            this.CanCancel = true;
            this.CanSearch = false;
            this.CanExport = false;

            tokenSource = new CancellationTokenSource();

            // todo: move to SearchAsync()
            Task.Run(() =>
            {
                this.searchService.Search(criteria, tokenSource);
            }, tokenSource.Token);
        }