Example #1
0
        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;
                    }
                }
            }
        }
Example #2
0
        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;
        }
Example #3
0
        private void OnGetLogs(UiExecutedPayload <GetLogsCommand, IList <Log> > obj)
        {
            this.Logs.Clear();

            foreach (var item in obj.Result)
            {
                this.Logs.Add(new LogViewModel(item));
            }
        }
Example #4
0
        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);
            }
        }
Example #5
0
        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;
        }
Example #6
0
        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;
            }
        }
Example #7
0
 private void OnSetEventViewerSortingCommand(UiExecutedPayload <SetEventViewerSortingCommand> obj)
 {
     this.SetSortingAndGrouping();
 }
Example #8
0
 private void OnSetEventViewerFilterCommand(UiExecutedPayload <SetEventViewerFilterCommand> obj)
 {
     this.OnPropertyChanged(nameof(SearchKey));
     this.LogsView.Refresh();
 }
Example #9
0
 private void OnSetPackageFilterCommand(UiExecutedPayload <SetPackageFilterCommand> obj)
 {
     this.OnPropertyChanged(nameof(SearchKey));
 }