/// <summary> /// Given some clues, fetch target type locations under those clues /// If null, fetch clues under home /// </summary> internal void Update(List <Clue> cluesSetup, DocumentType type) { AvailableClueStrings = new ObservableCollection <string>(); Type = type; if (cluesSetup != null) { // Search using given clues FoundDocuments = ClueManager.Manager.GetDocumentsFilterByType(cluesSetup, type); AvailableClues = cluesSetup; } else { // Search using home ClueManager.Manager.GetDocumentsAndCluesFilterByType(out AvailableClues, type); FoundDocuments = new List <Document>(); // Make it empty } // Update clues combo and add all as selected foreach (Clue clue in AvailableClues) { // Combo AvailableClueStrings.Add(clue.Name); // List if (cluesSetup != null) // Select available clues only if we have a solid target; otherwise there might be too many things to load { ListBoxItem item = new ListBoxItem(); item.Content = clue.Name; SelectedClues.Items.Add(item); } } // Invoke External Handlers to do an update ClueFilterUpdatedEvent.Invoke(FoundDocuments, AvailableClues); }
private void SearchUsingSelectedClues() { // Invoke External Handlers to do an update List <Clue> availableClues = new List <Clue>(); foreach (ListBoxItem item in SelectedClues.Items) { availableClues.Add(new Clue(item.Content as string)); } List <Document> foundDocuments = ClueManager.Manager.GetDocumentsFilterByType(availableClues, Type); ClueFilterUpdatedEvent.Invoke(foundDocuments, availableClues); // <Development> Seem not very economical }