/// <summary> /// Handles a click on the CloseDocument button. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event arguments.</param> private void CloseDocumentButton_Click(object sender, RoutedEventArgs e) { Button closeButton = sender as Button; // Close the document the button belongs to ViewModel.SearchControlViewModel viewModel = (ViewModel.SearchControlViewModel) this.DataContext; var documentViewModel = closeButton.DataContext as ViewModel.DocumentViewModel; viewModel.CloseDocument(documentViewModel.FilePath); }
/// <summary> /// Handles a click on the open file button in the file list. /// </summary> /// <param name="sender">Event sender</param> /// <param name="e">Event arguments</param> private void btnOpenFileClick(object sender, RoutedEventArgs e) { // Determine the file, which belongs to the button. var fileItem = ((Button)sender).Tag as string; if (fileItem != null) { // Open the file, the user clicked on. ViewModel.SearchControlViewModel viewModel = (ViewModel.SearchControlViewModel) this.DataContext; viewModel.OpenDocument(fileItem); } }
/// <summary> /// Searches for a specific tag. /// </summary> /// <param name="tagInfo">Tag info, of tag, which should be searched</param> private void SearchTag(TagInfo tagInfo) { ViewModel.SearchControlViewModel searchControlViewModel = (ViewModel.SearchControlViewModel) this.DataContext; var currentSearchViewModel = searchControlViewModel.CurrentSearch; if (currentSearchViewModel == null) { return; } if (tagInfo != null) { currentSearchViewModel.TagSearchProcessor.Search(tagInfo.Tag); currentSearchViewModel.CurrentSearchProcessorIndex = 1; } }
/// <summary> /// Handles the change of the Indexes property. /// </summary> /// <param name="oldValue">Old property value.</param> /// <param name="newValue">New property value.</param> protected virtual void OnIndexesChanged(IEnumerable <IIndex> oldValue, IEnumerable <IIndex> newValue) { DataContext = new ViewModel.SearchControlViewModel(newValue, UserSettings); }