private void OnSetToolFilter(UiExecutedPayload <SetToolFilterCommand> obj) { var host = this.Host; for (var i = 0; i < host.Children.Count; i++) { if (!(host.Children[i] is TextBlock text)) { continue; } var nextElement = i + 1 < host.Children.Count ? host.Children[i + 1] as WrapPanel : null; if (nextElement == null) { text.Visibility = Visibility.Visible; } else { var anyVisible = false; bool allVisible; if (string.IsNullOrEmpty(obj.Command.SearchKey) || text.Text.IndexOf(obj.Command.SearchKey, StringComparison.OrdinalIgnoreCase) > -1) { text.Visibility = Visibility.Visible; allVisible = true; } else { text.Visibility = Visibility.Collapsed; allVisible = false; } foreach (var button in nextElement.Children.OfType <Button>()) { if (allVisible || string.IsNullOrEmpty(obj.Command.SearchKey)) { anyVisible = true; button.Visibility = Visibility.Visible; } else { var buttonTexts = ((StackPanel)button.Content).Children.OfType <TextBlock>(); var hasText = buttonTexts.Any(b => b.Text?.IndexOf(obj.Command.SearchKey, StringComparison.OrdinalIgnoreCase) > -1); anyVisible |= hasText; button.Visibility = hasText ? Visibility.Visible : Visibility.Collapsed; } } if (allVisible || string.IsNullOrEmpty(obj.Command.SearchKey) || anyVisible) { text.Visibility = Visibility.Visible; } else { text.Visibility = Visibility.Collapsed; } } } }
private void OnGetLogsCommandExecuted(UiExecutedPayload <GetLogsCommand> obj) { this.ListBox.SelectedItem = this.ListBox.Items.OfType <LogViewModel>() .FirstOrDefault(item => this.application.ApplicationState.EventViewer.SelectedLog == item.Model); this.ListBox.SelectionChanged += this.OnSelectionChanged; }
private void OnGetLogs(UiExecutedPayload <GetLogsCommand, IList <Log> > obj) { this.Logs.Clear(); foreach (var item in obj.Result) { this.Logs.Add(new LogViewModel(item)); } }
private void OnSelectLogCommand(UiExecutedPayload <SelectLogCommand> command) { var parameters = new NavigationParameters(); if (command.Command.SelectedLog == null) { prismServices.RegionManager.Regions[EventViewerRegionNames.Details].RequestNavigate(new Uri(NavigationPaths.EventViewerPaths.NoDetails, UriKind.Relative), parameters); } else { parameters.Add("selection", this.application.ApplicationState.EventViewer.SelectedLog); prismServices.RegionManager.Regions[EventViewerRegionNames.Details].RequestNavigate(new Uri(NavigationPaths.EventViewerPaths.Details, UriKind.Relative), parameters); } }
private void OnGetVolumesExecuted(UiExecutedPayload <GetVolumesCommand> obj) { this.ListBox.SelectedItems.Clear(); foreach (var item in this.ListBox.Items.OfType <VolumeViewModel>()) { if (!this.application.ApplicationState.Volumes.SelectedVolumes.Contains(item.Model)) { continue; } this.ListBox.SelectedItems.Add(item); } this.ListBox.SelectionChanged += this.OnSelectionChanged; }
private void OnSelectPackages(UiExecutedPayload <SelectPackagesCommand> obj) { var parameters = new NavigationParameters { { "packages", this.application.ApplicationState.Packages.SelectedPackages } }; switch (this.application.ApplicationState.Packages.SelectedPackages.Count) { case 0: this.prismServices.RegionManager.Regions[PackageManagementRegionNames.Details].RequestNavigate(new Uri(NavigationPaths.PackageManagementPaths.ZeroSelection, UriKind.Relative), parameters); break; case 1: this.prismServices.RegionManager.Regions[PackageManagementRegionNames.Details].RequestNavigate(new Uri(NavigationPaths.PackageManagementPaths.SingleSelection, UriKind.Relative), parameters); break; default: this.prismServices.RegionManager.Regions[PackageManagementRegionNames.Details].NavigationService.RequestNavigate(new Uri(NavigationPaths.PackageManagementPaths.MultipleSelection, UriKind.Relative), parameters); break; } }
private void OnSetEventViewerSortingCommand(UiExecutedPayload <SetEventViewerSortingCommand> obj) { this.SetSortingAndGrouping(); }
private void OnSetEventViewerFilterCommand(UiExecutedPayload <SetEventViewerFilterCommand> obj) { this.OnPropertyChanged(nameof(SearchKey)); this.LogsView.Refresh(); }
private void OnSetPackageFilterCommand(UiExecutedPayload <SetPackageFilterCommand> obj) { this.OnPropertyChanged(nameof(SearchKey)); }