From b4e6ada8d650167f7c6f9047b421c275c1d44216 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Sun, 21 Apr 2019 06:41:32 -0700 Subject: [PATCH 01/22] add GraphicalHost --- build.psm1 | 3 +- ...crosoft.PowerShell.Commands.Utility.csproj | 17 - .../OutGridView/OutGridViewCommand.cs | 2 +- .../utility/ShowCommand/ShowCommand.cs | 6 +- .../CommonHelper.cs | 68 + .../HelpWindow/HelpParagraphBuilder.cs | 977 ++++++ .../HelpWindow/HelpViewModel.cs | 283 ++ .../HelpWindow/HelpWindow.xaml | 71 + .../HelpWindow/HelpWindow.xaml.cs | 304 ++ .../HelpWindow/HelpWindowSettings.Designer.cs | 248 ++ .../HelpWindow/HelpWindowSettings.settings | 60 + .../HelpWindow/ParagraphBuilder.cs | 377 +++ .../HelpWindow/ParagraphSearcher.cs | 241 ++ .../HelpWindow/SettingsDialog.xaml | 58 + .../HelpWindow/SettingsDialog.xaml.cs | 64 + .../ManagementList/Common/AutomationButton.cs | 78 + .../ManagementList/Common/AutomationImage.cs | 77 + .../Common/AutomationTextBlock.cs | 43 + .../AutomationTextBlockAutomationPeer.cs | 52 + .../ManagementList/Common/BooleanBoxes.cs | 44 + .../ManagementList/Common/CommandHelper.cs | 51 + .../Common/CustomTypeComparer.cs | 74 + .../Common/DataRoutedEventArgs.cs | 41 + .../Common/DateTimeApproximationComparer.cs | 68 + .../Common/DismissiblePopup.Generated.cs | 273 ++ .../ManagementList/Common/DismissiblePopup.cs | 151 + .../ExtendedFrameworkElementAutomationPeer.cs | 99 + .../ManagementList/Common/IAsyncProgress.cs | 38 + .../Common/IStateDescriptorFactory.cs | 24 + .../Common/IntegralConverter.cs | 87 + .../Common/InverseBooleanConverter.cs | 48 + .../ManagementList/Common/IsEqualConverter.cs | 74 + .../Common/IsNotNullConverter.cs | 47 + .../ManagementList/Common/KeyboardHelp.cs | 149 + .../Common/ListOrganizer.Generated.cs | 487 +++ .../ManagementList/Common/ListOrganizer.cs | 64 + .../Common/ListOrganizerItem.Generated.cs | 151 + .../Common/ListOrganizerItem.cs | 260 ++ .../Common/MessageTextBox.Generated.cs | 148 + .../ManagementList/Common/MessageTextBox.cs | 60 + .../Common/PickerBase.Generated.cs | 261 ++ .../ManagementList/Common/PickerBase.cs | 134 + .../Common/PopupControlButton.Generated.cs | 83 + .../Common/PopupControlButton.cs | 131 + .../Common/PropertyChangedEventArgs.cs | 44 + .../ReadOnlyObservableAsyncCollection.cs | 133 + .../Common/ScalableImage.Generated.cs | 95 + .../ManagementList/Common/ScalableImage.cs | 117 + .../Common/ScalableImageSource.Generated.cs | 228 ++ .../Common/ScalableImageSource.cs | 47 + .../ManagementList/Common/StateDescriptor.cs | 84 + .../Common/StringFormatConverter.cs | 57 + .../Common/TextBlockService.Generated.cs | 172 + .../ManagementList/Common/TextBlockService.cs | 91 + .../Common/TextTrimConverter.cs | 68 + .../ManagementList/Common/Utilities.cs | 189 ++ .../Common/VisualToAncestorDataConverter.cs | 67 + .../Common/WeakEventListener.cs | 49 + .../ManagementList/Common/WpfHelp.cs | 607 ++++ .../CommonControls/AutomationGroup.cs | 24 + .../ExpanderButton.Generated.cs | 34 + .../CommonControls/ExpanderButton.cs | 129 + .../ExpanderButtonAutomationPeer.cs | 114 + .../CommonControls/Resizer.Generated.cs | 416 +++ .../ManagementList/CommonControls/Resizer.cs | 228 ++ .../ResizerGripThicknessConverter.cs | 72 + .../UIElementAdorner.Generated.cs | 81 + .../CommonControls/UIElementAdorner.cs | 106 + .../DefaultFilterRuleCustomizationFactory.cs | 350 +++ .../FilterCore/FilterEvaluator.cs | 244 ++ .../FilterCore/FilterExceptionEventArgs.cs | 43 + .../FilterExpressionAndOperatorNode.cs | 98 + .../FilterExpressionNode.cs | 72 + .../FilterExpressionOperandNode.cs | 72 + .../FilterExpressionOrOperatorNode.cs | 98 + .../FilterRuleCustomizationFactory.cs | 109 + .../FilterRules/ComparableValueFilterRule.cs | 78 + .../FilterRules/DoesNotEqualFilterRule.cs | 42 + .../FilterRules/EqualsFilterRule.cs | 45 + .../FilterCore/FilterRules/FilterRule.cs | 79 + .../FilterRules/FilterRuleExtensions.cs | 56 + .../FilterRules/IsBetweenFilterRule.cs | 120 + .../FilterRules/IsEmptyFilterRule.cs | 49 + .../FilterRules/IsGreaterThanFilterRule.cs | 45 + .../FilterRules/IsLessThanFilterRule.cs | 45 + .../FilterRules/IsNotEmptyFilterRule.cs | 37 + .../FilterRules/IsNotEmptyValidationRule.cs | 62 + .../PropertiesTextContainsFilterRule.cs | 130 + .../PropertyValueSelectorFilterRule.cs | 150 + .../FilterRules/SelectorFilterRule.cs | 119 + .../SingleValueComparableValueFilterRule.cs | 72 + .../FilterRules/TextContainsFilterRule.cs | 45 + .../TextDoesNotContainFilterRule.cs | 39 + .../FilterRules/TextDoesNotEqualFilterRule.cs | 39 + .../FilterRules/TextEndsWithFilterRule.cs | 44 + .../FilterRules/TextEqualsFilterRule.cs | 43 + .../FilterCore/FilterRules/TextFilterRule.cs | 167 + .../FilterRules/TextStartsWithFilterRule.cs | 45 + .../ManagementList/FilterCore/FilterStatus.cs | 30 + .../FilterCore/FilterUtilities.cs | 47 + .../ManagementList/FilterCore/IEvaluate.cs | 26 + .../FilterCore/IFilterExpressionProvider.cs | 38 + .../FilterCore/ItemsControlFilterEvaluator.cs | 143 + .../FilterCore/ValidatingSelectorValue.cs | 249 ++ .../FilterCore/ValidatingValue.cs | 216 ++ .../FilterCore/ValidatingValueBase.cs | 326 ++ .../DataErrorInfoValidationResult.cs | 78 + .../DataErrorInfoValidationRule.cs | 29 + .../AddFilterRulePicker.Generated.cs | 262 ++ .../FilterProviders/AddFilterRulePicker.cs | 104 + .../AddFilterRulePickerItem.cs | 83 + .../FilterRulePanel.Generated.cs | 104 + .../FilterProviders/FilterRulePanel.cs | 384 +++ .../FilterRulePanelContentPresenter.cs | 54 + .../FilterRulePanelController.cs | 281 ++ .../FilterProviders/FilterRulePanelItem.cs | 119 + .../FilterRulePanelItemType.cs | 31 + .../FilterRuleTemplateSelector.cs | 75 + .../FilterRuleToDisplayNameConverter.cs | 76 + .../InputFieldBackgroundTextConverter.cs | 111 + .../IsValidatingValueValidConverter.cs | 55 + .../FilterProviders/SearchBox.Generated.cs | 190 ++ .../FilterProviders/SearchBox.cs | 142 + .../FilterProviders/SearchTextParseResult.cs | 38 + .../FilterProviders/SearchTextParser.cs | 258 ++ ...tingSelectorValueToDisplayNameConverter.cs | 91 + ...ingValueToGenericParameterTypeConverter.cs | 69 + .../ManagementList/ColumnPicker.xaml | 205 ++ .../ManagementList/ColumnPicker.xaml.cs | 372 +++ .../ManagementList/DefaultStringConverter.cs | 93 + .../ManagementList/IPropertyValueGetter.cs | 27 + .../ManagementList/InnerList.Generated.cs | 225 ++ .../InnerListColumn.Generated.cs | 208 ++ .../ManagementList/InnerListGridView.cs | 298 ++ .../ManagementList/Innerlist.cs | 716 +++++ .../ManagementList.Generated.cs | 850 +++++ .../ManagementListStateDescriptor.cs | 606 ++++ .../ManagementListStateDescriptorFactory.cs | 24 + .../ManagementListTitle.Generated.cs | 257 ++ .../ManagementList/ManagementListTitle.cs | 22 + .../ManagementList/PropertyValueComparer.cs | 143 + .../ManagementList/PropertyValueGetter.cs | 131 + .../UIPropertyGroupDescription.cs | 127 + .../ViewGroupToStringConverter.cs | 63 + .../ManagementList/ManagementList/WaitRing.cs | 24 + .../ManagementList/innerlistcolumn.cs | 176 ++ .../ManagementList/managementlist.cs | 423 +++ .../Microsoft.PowerShell.GraphicalHost.csproj | 34 + .../Controls/AllModulesControl.xaml | 48 + .../Controls/AllModulesControl.xaml.cs | 49 + .../ShowCommand/Controls/CmdletControl.xaml | 57 + .../Controls/CmdletControl.xaml.cs | 102 + .../Controls/ImageButton/ImageButton.xaml | 21 + .../Controls/ImageButton/ImageButton.xaml.cs | 46 + .../Controls/ImageButton/ImageButtonBase.cs | 64 + .../ImageButton/ImageButtonCommon.xaml | 124 + .../ImageButtonToolTipConverter.cs | 73 + .../ImageButton/ImageToggleButton.xaml | 24 + .../ImageButton/ImageToggleButton.xaml.cs | 60 + .../Controls/MultipleSelectionControl.xaml | 22 + .../Controls/MultipleSelectionControl.xaml.cs | 57 + .../Controls/NotImportedCmdletControl.xaml | 23 + .../Controls/NotImportedCmdletControl.xaml.cs | 24 + .../Controls/ParameterSetControl.xaml | 17 + .../Controls/ParameterSetControl.xaml.cs | 406 +++ .../Controls/ShowModuleControl.xaml | 29 + .../Controls/ShowModuleControl.xaml.cs | 86 + .../ShowCommandSettings.Designer.cs | 146 + .../ShowCommand/ShowCommandSettings.settings | 36 + .../ViewModel/AllModulesViewModel.cs | 659 ++++ .../ShowCommand/ViewModel/CommandEventArgs.cs | 35 + .../ShowCommand/ViewModel/CommandViewModel.cs | 650 ++++ .../ViewModel/HelpNeededEventArgs.cs | 35 + .../ViewModel/ImportModuleEventArgs.cs | 70 + .../ShowCommand/ViewModel/ModuleViewModel.cs | 531 ++++ .../ViewModel/ParameterSetViewModel.cs | 394 +++ .../ViewModel/ParameterViewModel.cs | 278 ++ .../Windows/MultipleSelectionDialog.xaml | 27 + .../Windows/MultipleSelectionDialog.xaml.cs | 43 + .../Windows/ShowAllModulesWindow.xaml | 34 + .../Windows/ShowAllModulesWindow.xaml.cs | 201 ++ .../Windows/ShowCommandWindow.xaml | 27 + .../Windows/ShowCommandWindow.xaml.cs | 71 + .../app.config | 99 + .../commandHelpers/HelpWindowHelper.cs | 55 + .../commandHelpers/OutGridView.cs | 599 ++++ .../commandHelpers/ShowCommandHelper.cs | 1304 ++++++++ .../generic.xaml | 2799 +++++++++++++++++ .../resources/GraphicalHostResources.resx | 123 + .../resources/Graphics/Add16.png | Bin 0 -> 550 bytes .../resources/Graphics/CloseTile16.png | Bin 0 -> 1014 bytes .../resources/Graphics/Delete16.png | Bin 0 -> 990 bytes .../resources/Graphics/Error16.png | Bin 0 -> 782 bytes .../resources/Graphics/Help.ico | Bin 0 -> 10134 bytes .../resources/Graphics/Rename16.png | Bin 0 -> 314 bytes .../resources/Graphics/Save16.png | Bin 0 -> 605 bytes .../Graphics/SortAdornerAscending.png | Bin 0 -> 264 bytes .../Graphics/SortAdornerDescending.png | Bin 0 -> 265 bytes .../resources/Graphics/SpyGlass10.png | Bin 0 -> 403 bytes .../resources/Graphics/SpyGlass16.png | Bin 0 -> 736 bytes .../resources/Graphics/down.ico | Bin 0 -> 198 bytes .../resources/HelpWindowResources.resx | 230 ++ .../resources/InvariantResources.resx | 148 + .../resources/ShowCommandResources.resx | 239 ++ .../resources/UICultureResources.resx | 230 ++ .../resources/XamlLocalizableResources.resx | 414 +++ .../Microsoft.PowerShell.Utility.psd1 | 2 +- .../System.Management.Automation.csproj | 1 - .../engine/InitialSessionState.cs | 4 +- .../powershell-win-core.csproj | 1 + 210 files changed, 31489 insertions(+), 26 deletions(-) create mode 100644 src/Microsoft.PowerShell.GraphicalHost/CommonHelper.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpParagraphBuilder.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpViewModel.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindowSettings.Designer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindowSettings.settings create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/ParagraphBuilder.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/ParagraphSearcher.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/SettingsDialog.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/HelpWindow/SettingsDialog.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationButton.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationImage.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationTextBlock.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationTextBlockAutomationPeer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/BooleanBoxes.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/CommandHelper.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/CustomTypeComparer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DataRoutedEventArgs.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DateTimeApproximationComparer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DismissiblePopup.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DismissiblePopup.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ExtendedFrameworkElementAutomationPeer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IAsyncProgress.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IStateDescriptorFactory.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IntegralConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/InverseBooleanConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IsEqualConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IsNotNullConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/KeyboardHelp.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ListOrganizer.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ListOrganizer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ListOrganizerItem.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ListOrganizerItem.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/MessageTextBox.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/MessageTextBox.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/PickerBase.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/PickerBase.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/PopupControlButton.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/PopupControlButton.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/PropertyChangedEventArgs.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ReadOnlyObservableAsyncCollection.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ScalableImage.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ScalableImage.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ScalableImageSource.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ScalableImageSource.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/StateDescriptor.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/StringFormatConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/TextBlockService.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/TextBlockService.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/TextTrimConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/Utilities.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/VisualToAncestorDataConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/WeakEventListener.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/WpfHelp.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/CommonControls/AutomationGroup.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/CommonControls/ExpanderButton.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/CommonControls/ExpanderButton.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/CommonControls/ExpanderButtonAutomationPeer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/CommonControls/Resizer.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/CommonControls/Resizer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/CommonControls/ResizerGripThicknessConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/CommonControls/UIElementAdorner.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/CommonControls/UIElementAdorner.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterEvaluator.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterExceptionEventArgs.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionNode.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/FilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/TextFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterStatus.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/FilterUtilities.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/IEvaluate.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/IFilterExpressionProvider.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/ValidatingSelectorValue.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/ValidatingValue.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/ValidatingValueBase.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/AddFilterRulePicker.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/AddFilterRulePicker.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/AddFilterRulePickerItem.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/FilterRulePanel.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/FilterRulePanel.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/FilterRulePanelController.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/FilterRulePanelItem.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/FilterRulePanelItemType.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/SearchBox.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/SearchBox.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/SearchTextParseResult.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/SearchTextParser.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/ColumnPicker.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/ColumnPicker.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/DefaultStringConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/IPropertyValueGetter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/InnerList.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/InnerListColumn.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/InnerListGridView.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/Innerlist.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/ManagementList.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/ManagementListStateDescriptor.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/ManagementListStateDescriptorFactory.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/ManagementListTitle.Generated.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/ManagementListTitle.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/PropertyValueComparer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/PropertyValueGetter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/UIPropertyGroupDescription.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/ViewGroupToStringConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/WaitRing.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/innerlistcolumn.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ManagementList/ManagementList/managementlist.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/Microsoft.PowerShell.GraphicalHost.csproj create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/AllModulesControl.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/AllModulesControl.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/CmdletControl.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/CmdletControl.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonBase.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/NotImportedCmdletControl.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/NotImportedCmdletControl.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.Designer.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.settings create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/AllModulesViewModel.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandEventArgs.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandViewModel.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/HelpNeededEventArgs.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ImportModuleEventArgs.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ModuleViewModel.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterSetViewModel.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterViewModel.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowAllModulesWindow.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowCommandWindow.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowCommandWindow.xaml.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/app.config create mode 100644 src/Microsoft.PowerShell.GraphicalHost/commandHelpers/HelpWindowHelper.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/commandHelpers/OutGridView.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/commandHelpers/ShowCommandHelper.cs create mode 100644 src/Microsoft.PowerShell.GraphicalHost/generic.xaml create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/GraphicalHostResources.resx create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Add16.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/CloseTile16.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Delete16.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Error16.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Help.ico create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Rename16.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Save16.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SortAdornerAscending.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SortAdornerDescending.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SpyGlass10.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SpyGlass16.png create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/down.ico create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/HelpWindowResources.resx create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/InvariantResources.resx create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/ShowCommandResources.resx create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/UICultureResources.resx create mode 100644 src/Microsoft.PowerShell.GraphicalHost/resources/XamlLocalizableResources.resx diff --git a/build.psm1 b/build.psm1 index 5e138dc56b1..2bd3cb1c69c 100644 --- a/build.psm1 +++ b/build.psm1 @@ -2210,7 +2210,7 @@ function Start-CrossGen { $crossGenRequiredAssemblies = @("mscorlib.dll", "System.Private.CoreLib.dll") $crossGenRequiredAssemblies += if ($Environment.IsWindows) { - "clrjit.dll" + "clrjit.dll" } elseif ($Environment.IsLinux) { "libclrjit.so" } elseif ($Environment.IsMacOS) { @@ -2269,6 +2269,7 @@ function Start-CrossGen { "Microsoft.WSMan.Management.dll", "Microsoft.WSMan.Runtime.dll", "Microsoft.PowerShell.Commands.Diagnostics.dll", + "Microsoft.PowerShell.GraphicalHost.dll", "Microsoft.Management.Infrastructure.CimCmdlets.dll" ) } diff --git a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj index 013e0fe8ea9..08705985f36 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj +++ b/src/Microsoft.PowerShell.Commands.Utility/Microsoft.PowerShell.Commands.Utility.csproj @@ -16,26 +16,10 @@ - - - - - - - - - - - - - - - - @@ -44,7 +28,6 @@ - diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs index e1c26880df7..54bd7f576e3 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs @@ -312,7 +312,7 @@ internal GridHeader(OutGridViewCommand parentCmd) internal static GridHeader ConstructGridHeader(PSObject input, OutGridViewCommand parentCmd) { if (DefaultScalarTypes.IsTypeInList(input.TypeNames) || - OutOfBandFormatViewManager.IsPropertyLessObject(input)) + !OutOfBandFormatViewManager.HasNonRemotingProperties(input)) { return new ScalarTypeHeader(parentCmd, input); } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs index 3681de8c4a7..92c73063135 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs @@ -225,8 +225,8 @@ protected override void EndProcessing() return; } - // We wait untill the window is loaded and then activate it - // to work arround the console window gaining activation somewhere + // We wait until the window is loaded and then activate it + // to work around the console window gaining activation somewhere // in the end of ProcessRecord, which causes the keyboard focus // (and use oif tab key to focus controls) to go away from the window _showCommandProxy.WindowLoaded.WaitOne(); @@ -280,7 +280,7 @@ private void RunScriptSilentlyAndWithErrorHookup(string script) output.DataAdded += new EventHandler(this.Output_DataAdded); _errors.DataAdded += new EventHandler(this.Error_DataAdded); - PowerShell ps = PowerShell.Create(RunspaceMode.CurrentRunspace); + System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace); ps.Streams.Error = _errors; ps.Commands.AddScript(script); diff --git a/src/Microsoft.PowerShell.GraphicalHost/CommonHelper.cs b/src/Microsoft.PowerShell.GraphicalHost/CommonHelper.cs new file mode 100644 index 00000000000..f0182c7ff60 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/CommonHelper.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Windows; + +namespace Microsoft.Management.UI +{ + /// + /// Utilities in common in this assembly + /// + internal static class CommonHelper + { + /// + /// Restore the values from the settings to the actual window position, size and state. + /// + /// the window we are setting position and size of + /// the value for top from the user settings + /// the value for left from the user settings + /// the value for width from the user settings + /// the value for height from the user settings + /// the with used if is not valid + /// the height used if is not valid + /// true if the window is maximized in the user setting + internal static void SetStartingPositionAndSize(Window target, double userSettingTop, double userSettingLeft, double userSettingWidth, double userSettingHeight, double defaultWidth, double defaultHeight, bool userSettingMaximized) + { + bool leftInvalid = userSettingLeft < System.Windows.SystemParameters.VirtualScreenLeft || + userSettingWidth > System.Windows.SystemParameters.VirtualScreenLeft + + System.Windows.SystemParameters.VirtualScreenWidth; + + bool topInvalid = userSettingTop < System.Windows.SystemParameters.VirtualScreenTop || + userSettingTop > System.Windows.SystemParameters.VirtualScreenTop + + System.Windows.SystemParameters.VirtualScreenHeight; + + bool widthInvalid = userSettingWidth < 0 || + userSettingWidth > System.Windows.SystemParameters.VirtualScreenWidth; + + bool heightInvalid = userSettingHeight < 0 || + userSettingHeight > System.Windows.SystemParameters.VirtualScreenHeight; + + if (leftInvalid || topInvalid) + { + target.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; + } + else + { + target.Left = userSettingLeft; + target.Top = userSettingTop; + } + + // If any saved coordinate is invalid, we set the window to the default position + if (widthInvalid || heightInvalid) + { + target.Width = defaultWidth; + target.Height = defaultHeight; + } + else + { + target.Width = userSettingWidth; + target.Height = userSettingHeight; + } + + if (userSettingMaximized) + { + target.WindowState = WindowState.Maximized; + } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpParagraphBuilder.cs b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpParagraphBuilder.cs new file mode 100644 index 00000000000..98eb8f99e75 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpParagraphBuilder.cs @@ -0,0 +1,977 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Diagnostics; +using System.Globalization; +using System.Management.Automation; +using System.Text; +using System.Windows.Documents; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Builds a help paragraph for a cmdlet + /// + internal class HelpParagraphBuilder : ParagraphBuilder + { + /// + /// Indentation size + /// + internal const int IndentSize = 4; + + /// + /// new line separators + /// + private static readonly string[] Separators = new string[] { "\r\n", "\n" }; + + /// + /// Object with the cmdelt + /// + private PSObject psObj; + + /// + /// Initializes a new instance of the HelpParagraphBuilder class + /// + /// paragraph being built + /// object with help information + internal HelpParagraphBuilder(Paragraph paragraph, PSObject psObj) + : base(paragraph) + { + this.psObj = psObj; + this.AddTextToParagraphBuilder(); + } + + /// + /// Enum for category of Help. + /// + private enum HelpCategory { Default, DscResource, Class }; + + /// + /// Gets the string value of a property or null if it could not be retrieved + /// + /// object with the property + /// property name + /// the string value of a property or null if it could not be retrieved + internal static string GetPropertyString(PSObject psObj, string propertyName) + { + Debug.Assert(psObj != null, "ensured by caller"); + object value = GetPropertyObject(psObj, propertyName); + + if (value == null) + { + return null; + } + + return value.ToString(); + } + + /// + /// Adds the help text to the paragraph + /// + internal void AddTextToParagraphBuilder() + { + this.ResetAllText(); + + string strCategory = (HelpParagraphBuilder.GetProperty(this.psObj, "Category")).Value.ToString(); + + HelpCategory category = HelpCategory.Default; + + if (String.Compare(strCategory, "DscResource", StringComparison.OrdinalIgnoreCase) == 0) + { + category = HelpCategory.DscResource; + } + else if (String.Compare(strCategory, "Class", StringComparison.OrdinalIgnoreCase) == 0) + { + category = HelpCategory.Class; + } + + if (HelpParagraphBuilder.GetProperty(this.psObj, "Syntax") == null) + { + if(category == HelpCategory.Default) + { + // if there is no syntax, this is not the standard help + // it might be an about page + this.AddText(this.psObj.ToString(), false); + return; + } + } + + switch (category) + { + case HelpCategory.Class: + this.AddDescription(HelpWindowSettings.Default.HelpSynopsysDisplayed, HelpWindowResources.SynopsisTitle, "Introduction"); + this.AddMembers(HelpWindowSettings.Default.HelpParametersDisplayed, HelpWindowResources.PropertiesTitle); + this.AddMembers(HelpWindowSettings.Default.HelpParametersDisplayed, HelpWindowResources.MethodsTitle); + break; + case HelpCategory.DscResource: + this.AddStringSection(HelpWindowSettings.Default.HelpSynopsysDisplayed, "Synopsis", HelpWindowResources.SynopsisTitle); + this.AddDescription(HelpWindowSettings.Default.HelpDescriptionDisplayed, HelpWindowResources.DescriptionTitle, "Description"); + this.AddParameters(HelpWindowSettings.Default.HelpParametersDisplayed, HelpWindowResources.PropertiesTitle, "Properties", HelpCategory.DscResource); + break; + default: + this.AddStringSection(HelpWindowSettings.Default.HelpSynopsysDisplayed, "Synopsis", HelpWindowResources.SynopsisTitle); + this.AddDescription(HelpWindowSettings.Default.HelpDescriptionDisplayed, HelpWindowResources.DescriptionTitle, "Description"); + this.AddParameters(HelpWindowSettings.Default.HelpParametersDisplayed, HelpWindowResources.ParametersTitle, "Parameters", HelpCategory.Default); + this.AddSyntax(HelpWindowSettings.Default.HelpSyntaxDisplayed, HelpWindowResources.SyntaxTitle); + break; + } + + this.AddInputOrOutputEntries(HelpWindowSettings.Default.HelpInputsDisplayed, HelpWindowResources.InputsTitle, "inputTypes", "inputType"); + this.AddInputOrOutputEntries(HelpWindowSettings.Default.HelpOutputsDisplayed, HelpWindowResources.OutputsTitle, "returnValues", "returnValue"); + this.AddNotes(HelpWindowSettings.Default.HelpNotesDisplayed, HelpWindowResources.NotesTitle); + this.AddExamples(HelpWindowSettings.Default.HelpExamplesDisplayed, HelpWindowResources.ExamplesTitle); + this.AddNavigationLink(HelpWindowSettings.Default.HelpRelatedLinksDisplayed, HelpWindowResources.RelatedLinksTitle); + this.AddStringSection(HelpWindowSettings.Default.HelpRemarksDisplayed, "Remarks", HelpWindowResources.RemarksTitle); + } + + /// + /// Gets the object property or null if it could not be retrieved + /// + /// object with the property + /// property name + /// the object property or null if it could not be retrieved + private static PSPropertyInfo GetProperty(PSObject psObj, string propertyName) + { + Debug.Assert(psObj != null, "ensured by caller"); + return psObj.Properties[propertyName]; + } + + /// + /// Gets a PSObject and then a value from it or null if the value could not be retrieved + /// + /// PSObject that contains another PSObject as a property + /// property name that contains the PSObject + /// property name in thye inner PSObject + /// the string from the inner psObject property or null if it could not be retrieved + private static string GetInnerPSObjectPropertyString(PSObject psObj, string psObjectName, string propertyName) + { + Debug.Assert(psObj != null, "ensured by caller"); + PSObject innerPsObj = GetPropertyObject(psObj, psObjectName) as PSObject; + + if (innerPsObj == null) + { + return null; + } + + object value = GetPropertyObject(innerPsObj, propertyName); + + if (value == null) + { + return null; + } + + return value.ToString(); + } + + /// + /// Gets the value of a property or null if the value could not be retrieved + /// + /// object with the property + /// property name + /// the value of a property or null if the value could not be retrieved + private static object GetPropertyObject(PSObject psObj, string propertyName) + { + Debug.Assert(psObj != null, "ensured by caller"); + PSPropertyInfo property = HelpParagraphBuilder.GetProperty(psObj, propertyName); + if (property == null) + { + return null; + } + + object value = null; + try + { + value = property.Value; + } + catch (ExtendedTypeSystemException) + { + } + + return value; + } + + /// + /// Gets the text from a property of type PSObject[] where the first object has a text property + /// + /// objhect to get text from + /// property with PSObject[] containing text + /// the text from a property of type PSObject[] where the first object has a text property + private static string GetTextFromArray(PSObject psObj, string propertyText) + { + PSObject[] introductionObjects = HelpParagraphBuilder.GetPropertyObject(psObj, propertyText) as PSObject[]; + if (introductionObjects != null && introductionObjects.Length > 0) + { + return GetPropertyString(introductionObjects[0], "text"); + } + + return null; + } + + /// + /// Returns the largest size of a group of strings + /// + /// strings to evaluate the largest size from + /// the largest size of a group of strings + private static int LargestSize(params string[] strs) + { + int returnValue = 0; + + foreach (string str in strs) + { + if (str != null && str.Length > returnValue) + { + returnValue = str.Length; + } + } + + return returnValue; + } + + /// + /// Splits the string adding indentation before each line + /// + /// string to add indentation to + /// the string indented + private static string AddIndent(string str) + { + return HelpParagraphBuilder.AddIndent(str, 1); + } + + /// + /// Splits the string adding indentation before each line + /// + /// string to add indentation to + /// number of indentations + /// the string indented + private static string AddIndent(string str, int numberOfIdents) + { + StringBuilder indent = new StringBuilder(); + indent.Append(' ', numberOfIdents * HelpParagraphBuilder.IndentSize); + return HelpParagraphBuilder.AddIndent(str, indent.ToString()); + } + + /// + /// Splits the string adding indentation before each line + /// + /// string to add indentation to + /// indentation string + /// the string indented + private static string AddIndent(string str, string indentString) + { + if (str == null) + { + return String.Empty; + } + + string[] lines = str.Split(Separators, StringSplitOptions.None); + + StringBuilder returnValue = new StringBuilder(); + foreach (string line in lines) + { + // Indentation is not localized + returnValue.AppendFormat("{0}{1}\r\n", indentString, line); + } + + if (returnValue.Length > 2) + { + // remove the last \r\n + returnValue.Remove(returnValue.Length - 2, 2); + } + + return returnValue.ToString(); + } + + /// + /// Get the object array value of a property + /// + /// object containing the property + /// property with the array value + /// the object array value of a property + private static object[] GetPropertyObjectArray(PSObject obj, string propertyName) + { + object innerObject; + if ((innerObject = HelpParagraphBuilder.GetPropertyObject(obj, propertyName)) == null) + { + return null; + } + + if (innerObject is PSObject) + { + return new object[] { innerObject }; + } + + object[] innerObjectArray = innerObject as object[]; + if (innerObject == null) + { + return null; + } + + return innerObjectArray; + } + + + /// + /// Adds a section that contains only a string + /// + /// true if it should add the segment + /// name of the section to add + /// title of the section + private void AddStringSection(bool setting, string sectionName, string sectionTitle) + { + string propertyValue; + if (!setting || (propertyValue = HelpParagraphBuilder.GetPropertyString(this.psObj, sectionName)) == null) + { + return; + } + + this.AddText(sectionTitle, true); + this.AddText("\r\n", false); + this.AddText(HelpParagraphBuilder.AddIndent(propertyValue), false); + this.AddText("\r\n\r\n", false); + } + + /// + /// Adds the help syntax segment + /// + /// true if it should add the segment + /// title of the section + private void AddSyntax(bool setting, string sectionTitle) + { + PSObject syntaxObject; + if (!setting || (syntaxObject = HelpParagraphBuilder.GetPropertyObject(this.psObj, "Syntax") as PSObject) == null) + { + return; + } + + object[] syntaxItemsObj = HelpParagraphBuilder.GetPropertyObjectArray(syntaxObject, "syntaxItem"); + if (syntaxItemsObj == null || syntaxItemsObj.Length == 0) + { + return; + } + + this.AddText(sectionTitle, true); + this.AddText("\r\n", false); + + foreach (object syntaxItemObj in syntaxItemsObj) + { + PSObject syntaxItem = syntaxItemObj as PSObject; + if (syntaxItem == null) + { + continue; + } + + string commandName = GetPropertyString(syntaxItem, "name"); + + object[] parameterObjs = HelpParagraphBuilder.GetPropertyObjectArray(syntaxItem, "parameter"); + if (commandName == null || parameterObjs == null || parameterObjs.Length == 0) + { + continue; + } + + string commandStart = String.Format(CultureInfo.CurrentCulture, "{0} ", commandName); + this.AddText(HelpParagraphBuilder.AddIndent(commandStart), false); + + foreach (object parameterObj in parameterObjs) + { + PSObject parameter = parameterObj as PSObject; + if (parameter == null) + { + continue; + } + + string parameterValue = GetPropertyString(parameter, "parameterValue"); + string position = GetPropertyString(parameter, "position"); + string required = GetPropertyString(parameter, "required"); + string parameterName = GetPropertyString(parameter, "name"); + if (position == null || required == null || parameterName == null) + { + continue; + } + + string parameterType = parameterValue == null ? String.Empty : String.Format(CultureInfo.CurrentCulture, "<{0}>", parameterValue); + + string parameterOptionalOpenBrace, parameterOptionalCloseBrace; + + if (String.Equals(required, "true", StringComparison.OrdinalIgnoreCase)) + { + parameterOptionalOpenBrace = parameterOptionalCloseBrace = String.Empty; + } + else + { + parameterOptionalOpenBrace = "["; + parameterOptionalCloseBrace = "]"; + } + + string parameterNameOptionalOpenBrace, parameterNameOptionalCloseBrace; + + if (String.Equals(position, "named", StringComparison.OrdinalIgnoreCase)) + { + parameterNameOptionalOpenBrace = parameterNameOptionalCloseBrace = String.Empty; + } + else + { + parameterNameOptionalOpenBrace = "["; + parameterNameOptionalCloseBrace = "]"; + } + + string paramterPrefix = String.Format( + CultureInfo.CurrentCulture, + "{0}{1}-", + parameterOptionalOpenBrace, + parameterNameOptionalOpenBrace); + + this.AddText(paramterPrefix, false); + this.AddText(parameterName, true); + + string paramterSuffix = String.Format( + CultureInfo.CurrentCulture, + "{0} {1}{2} ", + parameterNameOptionalCloseBrace, + parameterType, + parameterOptionalCloseBrace); + this.AddText(paramterSuffix, false); + } + + string commonParametersText = String.Format( + CultureInfo.CurrentCulture, + "[<{0}>]\r\n\r\n", + HelpWindowResources.CommonParameters); + + this.AddText(commonParametersText, false); + } + + this.AddText("\r\n", false); + } + + /// + /// Adds the help description segment + /// + /// true if it should add the segment + /// title of the section + /// propertyName that has description + private void AddDescription(bool setting, string sectionTitle, string propertyName) + { + PSObject[] descriptionObjects; + if (!setting || + (descriptionObjects = HelpParagraphBuilder.GetPropertyObject(this.psObj, propertyName) as PSObject[]) == null || + descriptionObjects.Length == 0) + { + return; + } + + this.AddText(sectionTitle, true); + this.AddText("\r\n", false); + + foreach (PSObject description in descriptionObjects) + { + string descriptionText = GetPropertyString(description, "text"); + this.AddText(HelpParagraphBuilder.AddIndent(descriptionText), false); + this.AddText("\r\n", false); + } + + this.AddText("\r\n\r\n", false); + } + + /// + /// Adds the help examples segment + /// + /// true if it should add the segment + /// title of the section + private void AddExamples(bool setting, string sectionTitle) + { + if (!setting) + { + return; + } + + PSObject exampleRootObject = HelpParagraphBuilder.GetPropertyObject(this.psObj, "Examples") as PSObject; + if (exampleRootObject == null) + { + return; + } + + object[] exampleObjects = HelpParagraphBuilder.GetPropertyObjectArray(exampleRootObject, "example"); + if (exampleObjects == null || exampleObjects.Length == 0) + { + return; + } + + this.AddText(sectionTitle, true); + this.AddText("\r\n", false); + + foreach (object exampleObj in exampleObjects) + { + PSObject example = exampleObj as PSObject; + if (example == null) + { + continue; + } + + string introductionText = null; + introductionText = GetTextFromArray(example, "introduction"); + + string codeText = GetPropertyString(example, "code"); + string title = GetPropertyString(example, "title"); + + if (codeText == null) + { + continue; + } + + if (title != null) + { + this.AddText(HelpParagraphBuilder.AddIndent(title), false); + this.AddText("\r\n", false); + } + + string codeLine = String.Format( + CultureInfo.CurrentCulture, + "{0}{1}\r\n\r\n", + introductionText, + codeText); + + this.AddText(HelpParagraphBuilder.AddIndent(codeLine), false); + + PSObject[] remarks = HelpParagraphBuilder.GetPropertyObject(example, "remarks") as PSObject[]; + if (remarks == null) + { + continue; + } + + foreach (PSObject remark in remarks) + { + string remarkText = GetPropertyString(remark, "text"); + if (remarkText == null) + { + continue; + } + + this.AddText(remarkText, false); + this.AddText("\r\n", false); + } + } + + this.AddText("\r\n\r\n", false); + } + + private void AddMembers(bool setting, string sectionTitle) + { + if(!setting || String.IsNullOrEmpty(sectionTitle)) + return; + + PSObject memberRootObject = HelpParagraphBuilder.GetPropertyObject(this.psObj, "Members") as PSObject; + if (memberRootObject == null) + return; + + object[] memberObjects = HelpParagraphBuilder.GetPropertyObjectArray(memberRootObject, "member"); + + if (memberObjects == null) + return; + + this.AddText(sectionTitle, true); + this.AddText("\r\n", false); + + foreach (object memberObj in memberObjects) + { + string description = null; + string memberText = null; + + PSObject member = memberObj as PSObject; + if (member == null) + continue; + + string name = GetPropertyString(member, "title"); + string type = GetPropertyString(member, "type"); + string propertyType = null; + + if (String.Compare("field", type, StringComparison.OrdinalIgnoreCase) == 0) + { + PSObject fieldData = HelpParagraphBuilder.GetPropertyObject(member, "fieldData") as PSObject; + + if (fieldData != null) + { + PSObject propertyTypeObject = HelpParagraphBuilder.GetPropertyObject(fieldData, "type") as PSObject; + if (propertyTypeObject != null) + { + propertyType = GetPropertyString(propertyTypeObject, "name"); + description = GetPropertyString(propertyTypeObject, "description"); + } + + memberText = String.Format(CultureInfo.CurrentCulture, " [{0}] {1}\r\n", propertyType, name); + } + } + else if (String.Compare("method", type, StringComparison.OrdinalIgnoreCase) == 0) + { + FormatMethodData(member, name, out memberText, out description); + } + + if (!String.IsNullOrEmpty(memberText)) + { + this.AddText(HelpParagraphBuilder.AddIndent(""), false); + this.AddText(memberText, true); + + if (description != null) + { + this.AddText(HelpParagraphBuilder.AddIndent(description, 2), false); + this.AddText("\r\n", false); + } + + this.AddText("\r\n", false); + } + } + } + + private void FormatMethodData(PSObject member, string name, out string memberText, out string description) + { + memberText = null; + description = null; + + if (member == null || String.IsNullOrEmpty(name)) + { + return; + } + + string returnType = null; + StringBuilder parameterText = new StringBuilder(); + + //Get method return type + PSObject returnTypeObject = HelpParagraphBuilder.GetPropertyObject(member, "returnValue") as PSObject; + if (returnTypeObject != null) + { + PSObject returnTypeData = HelpParagraphBuilder.GetPropertyObject(returnTypeObject, "type") as PSObject; + if (returnTypeData != null) + returnType = GetPropertyString(returnTypeData, "name"); + } + + //Get method description. + PSObject[] methodDescriptions = HelpParagraphBuilder.GetPropertyObject(member, "introduction") as PSObject[]; + if (methodDescriptions != null) + { + foreach (var methodDescription in methodDescriptions) + { + description = GetPropertyString(methodDescription, "Text"); + + //If we get an text we do not need to iterate more. + if (!String.IsNullOrEmpty(description)) + break; + } + } + + //Get method parameters. + PSObject parametersObject = HelpParagraphBuilder.GetPropertyObject(member, "parameters") as PSObject; + if (parametersObject != null) + { + PSObject[] paramObject = HelpParagraphBuilder.GetPropertyObject(parametersObject, "parameter") as PSObject[]; + + if (paramObject != null) + { + foreach (var param in paramObject) + { + string parameterName = GetPropertyString(param, "name"); + string parameterType = null; + + PSObject parameterTypeData = HelpParagraphBuilder.GetPropertyObject(param, "type") as PSObject; + + if (parameterTypeData != null) + { + parameterType = GetPropertyString(parameterTypeData, "name"); + + //If there is no type for the paramter, we expect it is System.Object + if (String.IsNullOrEmpty(parameterType)) + parameterType = "object"; + } + + string paramString = String.Format(CultureInfo.CurrentCulture, "[{0}] ${1},", parameterType, parameterName); + + parameterText.Append(paramString); + } + + if (String.Compare(parameterText[parameterText.Length - 1].ToString(), ",", StringComparison.OrdinalIgnoreCase) == 0) + { + parameterText = parameterText.Remove(parameterText.Length - 1, 1); + } + } + } + + memberText = String.Format(CultureInfo.CurrentCulture, " [{0}] {1}({2})\r\n", returnType, name, parameterText.ToString()); + } + + /// + /// Adds the help parameters segment + /// + /// true if it should add the segment + /// title of the section + /// name of the property which has properties + /// category of help + private void AddParameters(bool setting, string sectionTitle, string paramPropertyName, HelpCategory helpCategory) + { + if (!setting) + { + return; + } + + PSObject parameterRootObject = HelpParagraphBuilder.GetPropertyObject(this.psObj, paramPropertyName) as PSObject; + if (parameterRootObject == null) + { + return; + } + + object[] parameterObjects = null; + + //Root object for Class has members not parameters. + if (helpCategory != HelpCategory.Class) + { + parameterObjects = HelpParagraphBuilder.GetPropertyObjectArray(parameterRootObject, "parameter"); + } + + if (parameterObjects == null || parameterObjects.Length == 0) + { + return; + } + + this.AddText(sectionTitle, true); + this.AddText("\r\n", false); + + foreach (object parameterObj in parameterObjects) + { + PSObject parameter = parameterObj as PSObject; + if (parameter == null) + { + continue; + } + + string parameterValue = GetPropertyString(parameter, "parameterValue"); + string name = GetPropertyString(parameter, "name"); + string description = GetTextFromArray(parameter, "description"); + string required = GetPropertyString(parameter, "required"); + string position = GetPropertyString(parameter, "position"); + string pipelineinput = GetPropertyString(parameter, "pipelineInput"); + string defaultValue = GetPropertyString(parameter, "defaultValue"); + string acceptWildcard = GetPropertyString(parameter, "globbing"); + + if (String.IsNullOrEmpty(name)) + { + continue; + } + + // This syntax string is not localized + + if (helpCategory == HelpCategory.DscResource) + this.AddText(HelpParagraphBuilder.AddIndent(""), false); + else + this.AddText(HelpParagraphBuilder.AddIndent("-"), false); + + this.AddText(name, true); + string parameterText = String.Format( + CultureInfo.CurrentCulture, + " <{0}>\r\n", + parameterValue); + + this.AddText(parameterText, false); + + if (description != null) + { + this.AddText(HelpParagraphBuilder.AddIndent(description, 2), false); + this.AddText("\r\n", false); + } + + this.AddText("\r\n", false); + + int largestSize = HelpParagraphBuilder.LargestSize( + HelpWindowResources.ParameterRequired, + HelpWindowResources.ParameterPosition, + HelpWindowResources.ParameterDefaultValue, + HelpWindowResources.ParameterPipelineInput, + HelpWindowResources.ParameterAcceptWildcard); + + // justification of parameter values is not localized + string formatString = String.Format( + CultureInfo.CurrentCulture, + "{{0,-{0}}}{{1}}", + largestSize + 2); + + string tableLine; + + tableLine = String.Format( + CultureInfo.CurrentCulture, + formatString, + HelpWindowResources.ParameterRequired, + required); + this.AddText(HelpParagraphBuilder.AddIndent(tableLine, 2), false); + this.AddText("\r\n", false); + + //these are not applicable for Dsc Resource help + if (helpCategory != HelpCategory.DscResource) + { + tableLine = String.Format( + CultureInfo.CurrentCulture, + formatString, + HelpWindowResources.ParameterPosition, + position); + this.AddText(HelpParagraphBuilder.AddIndent(tableLine, 2), false); + this.AddText("\r\n", false); + + tableLine = String.Format( + CultureInfo.CurrentCulture, + formatString, + HelpWindowResources.ParameterDefaultValue, + defaultValue); + this.AddText(HelpParagraphBuilder.AddIndent(tableLine, 2), false); + this.AddText("\r\n", false); + + tableLine = String.Format( + CultureInfo.CurrentCulture, + formatString, + HelpWindowResources.ParameterPipelineInput, + pipelineinput); + this.AddText(HelpParagraphBuilder.AddIndent(tableLine, 2), false); + this.AddText("\r\n", false); + + tableLine = String.Format( + CultureInfo.CurrentCulture, + formatString, + HelpWindowResources.ParameterAcceptWildcard, + acceptWildcard); + this.AddText(HelpParagraphBuilder.AddIndent(tableLine, 2), false); + } + + this.AddText("\r\n\r\n", false); + } + + this.AddText("\r\n\r\n", false); + } + + /// + /// Adds the help navigation links segment + /// + /// true if it should add the segment + /// title of the section + private void AddNavigationLink(bool setting, string sectionTitle) + { + if (!setting) + { + return; + } + + PSObject linkRootObject = HelpParagraphBuilder.GetPropertyObject(this.psObj, "RelatedLinks") as PSObject; + if (linkRootObject == null) + { + return; + } + + PSObject[] linkObjects; + + if ((linkObjects = HelpParagraphBuilder.GetPropertyObject(linkRootObject, "navigationLink") as PSObject[]) == null || + linkObjects.Length == 0) + { + return; + } + + this.AddText(sectionTitle, true); + this.AddText("\r\n", false); + + foreach (PSObject linkObject in linkObjects) + { + string text = GetPropertyString(linkObject, "linkText"); + string uri = GetPropertyString(linkObject, "uri"); + + string linkLine = String.IsNullOrEmpty(uri) ? text : String.Format( + CultureInfo.CurrentCulture, + HelpWindowResources.LinkTextFormat, + text, + uri); + + this.AddText(HelpParagraphBuilder.AddIndent(linkLine), false); + this.AddText("\r\n", false); + } + + this.AddText("\r\n\r\n", false); + } + + /// + /// Adds the help input or output segment + /// + /// true if it should add the segment + /// title of the section + /// property with the outter object + /// property with the inner object + private void AddInputOrOutputEntries(bool setting, string sectionTitle, string inputOrOutputProperty, string inputOrOutputInnerProperty) + { + if (!setting) + { + return; + } + + PSObject rootObject = HelpParagraphBuilder.GetPropertyObject(this.psObj, inputOrOutputProperty) as PSObject; + if (rootObject == null) + { + return; + } + + object[] inputOrOutputObjs; + inputOrOutputObjs = HelpParagraphBuilder.GetPropertyObjectArray(rootObject, inputOrOutputInnerProperty); + + if (inputOrOutputObjs == null || inputOrOutputObjs.Length == 0) + { + return; + } + + this.AddText(sectionTitle, true); + this.AddText("\r\n", false); + + foreach (object inputOrOutputObj in inputOrOutputObjs) + { + PSObject inputOrOutput = inputOrOutputObj as PSObject; + if (inputOrOutput == null) + { + continue; + } + + string type = HelpParagraphBuilder.GetInnerPSObjectPropertyString(inputOrOutput, "type", "name"); + string description = GetTextFromArray(inputOrOutput, "description"); + + this.AddText(HelpParagraphBuilder.AddIndent(type), false); + this.AddText("\r\n", false); + if (description != null) + { + this.AddText(HelpParagraphBuilder.AddIndent(description), false); + this.AddText("\r\n", false); + } + } + + this.AddText("\r\n", false); + } + + /// + /// Adds the help notes segment + /// + /// true if it should add the segment + /// title of the section + private void AddNotes(bool setting, string sectionTitle) + { + if (!setting) + { + return; + } + + PSObject rootObject = HelpParagraphBuilder.GetPropertyObject(this.psObj, "alertSet") as PSObject; + if (rootObject == null) + { + return; + } + + string note = GetTextFromArray(rootObject, "alert"); + + if (note == null) + { + return; + } + + this.AddText(sectionTitle, true); + this.AddText("\r\n", false); + this.AddText(HelpParagraphBuilder.AddIndent(note), false); + this.AddText("\r\n\r\n", false); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpViewModel.cs b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpViewModel.cs new file mode 100644 index 00000000000..ed7abab54f8 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpViewModel.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Globalization; +using System.Management.Automation; +using System.Windows.Documents; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// ViewModel for the Help Dialog used to: + /// build the help document + /// search the help document + /// offer text for labels + /// + internal class HelpViewModel : INotifyPropertyChanged + { + /// + /// The builder for the help FlowDocument Paragraph used in a RichEditText control + /// + private HelpParagraphBuilder helpBuilder; + + /// + /// Searcher for selecting current matches in paragraph text + /// + private ParagraphSearcher searcher; + + /// + /// Title of the help window + /// + private string helpTitle; + + /// + /// the zoom bound to the zoom slider value + /// + private double zoom = 100; + + /// + /// Text to be found. This is bound to the find TextBox + /// + private string findText; + + /// + /// text for the number of matches found + /// + private string matchesLabel; + + /// + /// Initializes a new instance of the HelpViewModel class + /// + /// object containing help + /// paragraph in which help text is built/searched + internal HelpViewModel(PSObject psObj, Paragraph documentParagraph) + { + Debug.Assert(psObj != null, "ensured by caller"); + Debug.Assert(documentParagraph != null, "ensured by caller"); + + this.helpBuilder = new HelpParagraphBuilder(documentParagraph, psObj); + this.helpBuilder.BuildParagraph(); + this.searcher = new ParagraphSearcher(); + this.helpBuilder.PropertyChanged += new PropertyChangedEventHandler(this.HelpBuilder_PropertyChanged); + this.helpTitle = String.Format( + CultureInfo.CurrentCulture, + HelpWindowResources.HelpTitleFormat, + HelpParagraphBuilder.GetPropertyString(psObj, "name")); + } + + #region INotifyPropertyChanged Members + /// + /// Used to notify of property changes + /// + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + /// + /// Gets or sets the Zoom bound to the zoom slider value + /// + public double Zoom + { + get + { + return this.zoom; + } + + set + { + this.zoom = value; + this.OnNotifyPropertyChanged("Zoom"); + this.OnNotifyPropertyChanged("ZoomLabel"); + this.OnNotifyPropertyChanged("ZoomLevel"); + } + } + + /// + /// Gets the value bound to the RichTextEdit zoom, which is calculated based on the zoom + /// + public double ZoomLevel + { + get + { + return this.zoom / 100.0; + } + } + + /// + /// Gets the label to be displayed for the zoom + /// + public string ZoomLabel + { + get + { + return String.Format(CultureInfo.CurrentCulture, HelpWindowResources.ZoomLabelTextFormat, this.zoom); + } + } + + /// + /// Gets or sets the text to be found + /// + public string FindText + { + get + { + return this.findText; + } + + set + { + this.findText = value; + this.Search(); + this.SetMatchesLabel(); + } + } + + /// + /// Gets the title of the window + /// + public string HelpTitle + { + get + { + return this.helpTitle; + } + } + + /// + /// Gets or sets the label for current matches + /// + public string MatchesLabel + { + get + { + return this.matchesLabel; + } + + set + { + this.matchesLabel = value; + this.OnNotifyPropertyChanged("MatchesLabel"); + } + } + + /// + /// Gets a value indicating whether there are matches to go to + /// + public bool CanGoToNextOrPrevious + { + get + { + return this.HelpBuilder.HighlightCount != 0; + } + } + + /// + /// Gets the searcher for selecting current matches in paragraph text + /// + internal ParagraphSearcher Searcher + { + get { return this.searcher; } + } + + /// + /// Gets the paragraph builder used to write help content + /// + internal HelpParagraphBuilder HelpBuilder + { + get { return this.helpBuilder; } + } + + /// + /// Highlights all matches to this.findText + /// Called when findText changes or whenever the search has to be refreshed + /// + internal void Search() + { + this.HelpBuilder.HighlightAllInstancesOf(this.findText, HelpWindowSettings.Default.HelpSearchMatchCase, HelpWindowSettings.Default.HelpSearchWholeWord); + this.searcher.ResetSearch(); + } + + /// + /// Increases Zoom if not above maximum + /// + internal void ZoomIn() + { + if (this.Zoom + HelpWindow.ZoomInterval <= HelpWindow.MaximumZoom) + { + this.Zoom += HelpWindow.ZoomInterval; + } + } + + /// + /// Decreases Zoom if not below minimum + /// + internal void ZoomOut() + { + if (this.Zoom - HelpWindow.ZoomInterval >= HelpWindow.MinimumZoom) + { + this.Zoom -= HelpWindow.ZoomInterval; + } + } + + /// + /// Called to update the matches label + /// + /// event sender + /// event arguments + private void HelpBuilder_PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == "HighlightCount") + { + this.SetMatchesLabel(); + this.OnNotifyPropertyChanged("CanGoToNextOrPrevious"); + } + } + + /// + /// Sets the current matches label + /// + private void SetMatchesLabel() + { + if (this.findText == null || this.findText.Trim().Length == 0) + { + this.MatchesLabel = String.Empty; + } + else + { + if (this.HelpBuilder.HighlightCount == 0) + { + this.MatchesLabel = HelpWindowResources.NoMatches; + } + else + { + if (this.HelpBuilder.HighlightCount == 1) + { + this.MatchesLabel = HelpWindowResources.OneMatch; + } + else + { + this.MatchesLabel = String.Format( + CultureInfo.CurrentCulture, + HelpWindowResources.SomeMatchesFormat, + this.HelpBuilder.HighlightCount); + } + } + } + } + + /// + /// Called internally to notify when a proiperty changed + /// + /// property name + private void OnNotifyPropertyChanged(string propertyName) + { + PropertyChangedEventHandler handler = this.PropertyChanged; + if (handler != null) + { + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml new file mode 100644 index 00000000000..48b2e412d67 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml.cs new file mode 100644 index 00000000000..95f10f2b823 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml.cs @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Globalization; +using System.Management.Automation; +using System.Windows; +using System.Windows.Documents; +using System.Windows.Input; + +using Microsoft.Management.UI.Internal; + +namespace Microsoft.Management.UI +{ + /// + /// A window displaying help content and allowing search + /// + public partial class HelpWindow : Window + { + /// + /// Minimum zoom in the slider + /// + public const double MinimumZoom = 20; + + /// + /// Maximum zoom in the slider + /// + public const double MaximumZoom = 300; + + /// + /// Zoom interval + /// + public const double ZoomInterval = 10; + + /// + /// The ViewModel for the dialog + /// + private HelpViewModel viewModel; + + /// + /// Initializes a new instance of the HelpWindow class + /// + /// the object with help information + public HelpWindow(PSObject helpObject) + { + InitializeComponent(); + this.viewModel = new HelpViewModel(helpObject, this.DocumentParagraph); + CommonHelper.SetStartingPositionAndSize( + this, + HelpWindowSettings.Default.HelpWindowTop, + HelpWindowSettings.Default.HelpWindowLeft, + HelpWindowSettings.Default.HelpWindowWidth, + HelpWindowSettings.Default.HelpWindowHeight, + double.Parse((string)HelpWindowSettings.Default.Properties["HelpWindowWidth"].DefaultValue, CultureInfo.InvariantCulture.NumberFormat), + double.Parse((string)HelpWindowSettings.Default.Properties["HelpWindowHeight"].DefaultValue, CultureInfo.InvariantCulture.NumberFormat), + HelpWindowSettings.Default.HelpWindowMaximized); + + this.ReadZoomUserSetting(); + + this.viewModel.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(this.ViewModel_PropertyChanged); + this.DataContext = this.viewModel; + + this.Loaded += new RoutedEventHandler(this.HelpDialog_Loaded); + this.Closed += new System.EventHandler(this.HelpDialog_Closed); + } + + /// + /// Handles the mouse wheel to zoom in/out + /// + /// event arguments + protected override void OnPreviewMouseWheel(MouseWheelEventArgs e) + { + if (Keyboard.Modifiers != ModifierKeys.Control) + { + return; + } + + if (e.Delta > 0) + { + this.viewModel.ZoomIn(); + e.Handled = true; + } + else + { + this.viewModel.ZoomOut(); + e.Handled = true; + } + } + + /// + /// Handles key down to fix the Page/Douwn going to end of help issue + /// And to implement some additional shortcuts like Ctrl+F and ZoomIn/ZoomOut + /// + /// event arguments + protected override void OnPreviewKeyDown(KeyEventArgs e) + { + if (Keyboard.Modifiers == ModifierKeys.None) + { + if (e.Key == Key.PageUp) + { + this.Scroll.PageUp(); + e.Handled = true; + return; + } + + if (e.Key == Key.PageDown) + { + this.Scroll.PageDown(); + e.Handled = true; + return; + } + } + + if (Keyboard.Modifiers == ModifierKeys.Control) + { + this.HandleZoomInAndZoomOut(e); + if (e.Handled) + { + return; + } + + if (e.Key == Key.F) + { + this.Find.Focus(); + e.Handled = true; + return; + } + } + + if (Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift)) + { + this.HandleZoomInAndZoomOut(e); + if (e.Handled) + { + return; + } + } + } + + /// + /// Reads the zoom part of the user settings + /// + private void ReadZoomUserSetting() + { + if (HelpWindowSettings.Default.HelpZoom < HelpWindow.MinimumZoom || HelpWindowSettings.Default.HelpZoom > HelpWindow.MaximumZoom) + { + HelpWindowSettings.Default.HelpZoom = 100; + } + + this.viewModel.Zoom = HelpWindowSettings.Default.HelpZoom; + } + + /// + /// Handles Zoom in and Zoom out keys + /// + /// event arguments + private void HandleZoomInAndZoomOut(KeyEventArgs e) + { + if (e.Key == Key.OemPlus || e.Key == Key.Add) + { + this.viewModel.ZoomIn(); + e.Handled = true; + } + + if (e.Key == Key.OemMinus || e.Key == Key.Subtract) + { + this.viewModel.ZoomOut(); + e.Handled = true; + } + } + + /// + /// Listens to changes in the zoom in order to update the user settings + /// + /// event sender + /// event arguments + private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + if (e.PropertyName == "Zoom") + { + HelpWindowSettings.Default.HelpZoom = this.viewModel.Zoom; + } + } + + /// + /// Saves the user settings + /// + /// event sender + /// event arguments + private void HelpDialog_Closed(object sender, System.EventArgs e) + { + HelpWindowSettings.Default.Save(); + } + + /// + /// Updates the user setting with window state + /// + /// event sender + /// event arguments + private void HelpDialog_StateChanged(object sender, System.EventArgs e) + { + HelpWindowSettings.Default.HelpWindowMaximized = this.WindowState == WindowState.Maximized; + } + + /// + /// Sets the positions from user settings and start monitoring position changes + /// + /// event sender + /// event arguments + private void HelpDialog_Loaded(object sender, RoutedEventArgs e) + { + this.StateChanged += new System.EventHandler(this.HelpDialog_StateChanged); + this.LocationChanged += new System.EventHandler(this.HelpDialog_LocationChanged); + this.SizeChanged += new SizeChangedEventHandler(this.HelpDialog_SizeChanged); + } + + /// + /// Saves size changes in user settings + /// + /// event sender + /// event arguments + private void HelpDialog_SizeChanged(object sender, SizeChangedEventArgs e) + { + HelpWindowSettings.Default.HelpWindowWidth = this.Width; + HelpWindowSettings.Default.HelpWindowHeight = this.Height; + } + + /// + /// Saves position changes in user settings + /// + /// event sender + /// event arguments + private void HelpDialog_LocationChanged(object sender, System.EventArgs e) + { + HelpWindowSettings.Default.HelpWindowTop = this.Top; + HelpWindowSettings.Default.HelpWindowLeft = this.Left; + } + + /// + /// Called when the settings button is clicked + /// + /// event sender + /// event arguments + private void Settings_Click(object sender, RoutedEventArgs e) + { + SettingsDialog settings = new SettingsDialog(); + settings.Owner = this; + + settings.ShowDialog(); + + if (settings.DialogResult == true) + { + this.viewModel.HelpBuilder.AddTextToParagraphBuilder(); + this.viewModel.Search(); + } + } + + /// + /// Called when the Previous button is clicked + /// + /// event sender + /// event arguments + private void PreviousMatch_Click(object sender, RoutedEventArgs e) + { + this.MoveToNextMatch(false); + } + + /// + /// Called when the Next button is clicked + /// + /// event sender + /// event arguments + private void NextMatch_Click(object sender, RoutedEventArgs e) + { + this.MoveToNextMatch(true); + } + + /// + /// Moves to the previous or next match + /// + /// true for forward false for backwards + private void MoveToNextMatch(bool forward) + { + TextPointer caretPosition = this.HelpText.CaretPosition; + Run nextRun = this.viewModel.Searcher.MoveAndHighlightNextNextMatch(forward, caretPosition); + this.MoveToRun(nextRun); + } + + /// + /// Moves to the caret and brings the view to the + /// + /// run to move to + private void MoveToRun(Run run) + { + if (run == null) + { + return; + } + + run.BringIntoView(); + this.HelpText.CaretPosition = run.ElementEnd; + this.HelpText.Focus(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindowSettings.Designer.cs b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindowSettings.Designer.cs new file mode 100644 index 00000000000..75260441491 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindowSettings.Designer.cs @@ -0,0 +1,248 @@ +// +// Copyright (C) Microsoft. All rights reserved. +// +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.16598 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +//namespace Microsoft.Management.UI.Internal { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class HelpWindowSettings : global::System.Configuration.ApplicationSettingsBase { + + private static HelpWindowSettings defaultInstance = ((HelpWindowSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new HelpWindowSettings()))); + + public static HelpWindowSettings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpRemarksDisplayed + { + get + { + return ((bool)(this["HelpRemarksDisplayed"])); + } + set + { + this["HelpRemarksDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpSyntaxDisplayed { + get { + return ((bool)(this["HelpSyntaxDisplayed"])); + } + set { + this["HelpSyntaxDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpExamplesDisplayed { + get { + return ((bool)(this["HelpExamplesDisplayed"])); + } + set { + this["HelpExamplesDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpSynopsysDisplayed { + get { + return ((bool)(this["HelpSynopsysDisplayed"])); + } + set { + this["HelpSynopsysDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpDescriptionDisplayed { + get { + return ((bool)(this["HelpDescriptionDisplayed"])); + } + set { + this["HelpDescriptionDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpParametersDisplayed { + get { + return ((bool)(this["HelpParametersDisplayed"])); + } + set { + this["HelpParametersDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpInputsDisplayed { + get { + return ((bool)(this["HelpInputsDisplayed"])); + } + set { + this["HelpInputsDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpOutputsDisplayed { + get { + return ((bool)(this["HelpOutputsDisplayed"])); + } + set { + this["HelpOutputsDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpNotesDisplayed { + get { + return ((bool)(this["HelpNotesDisplayed"])); + } + set { + this["HelpNotesDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HelpRelatedLinksDisplayed { + get { + return ((bool)(this["HelpRelatedLinksDisplayed"])); + } + set { + this["HelpRelatedLinksDisplayed"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool HelpSearchMatchCase { + get { + return ((bool)(this["HelpSearchMatchCase"])); + } + set { + this["HelpSearchMatchCase"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool HelpSearchWholeWord { + get { + return ((bool)(this["HelpSearchWholeWord"])); + } + set { + this["HelpSearchWholeWord"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("400")] + public double HelpWindowHeight { + get { + return ((double)(this["HelpWindowHeight"])); + } + set { + this["HelpWindowHeight"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("600")] + public double HelpWindowWidth { + get { + return ((double)(this["HelpWindowWidth"])); + } + set { + this["HelpWindowWidth"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double HelpWindowTop { + get { + return ((double)(this["HelpWindowTop"])); + } + set { + this["HelpWindowTop"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double HelpWindowLeft { + get { + return ((double)(this["HelpWindowLeft"])); + } + set { + this["HelpWindowLeft"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool HelpWindowMaximized { + get { + return ((bool)(this["HelpWindowMaximized"])); + } + set { + this["HelpWindowMaximized"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("100")] + public double HelpZoom { + get { + return ((double)(this["HelpZoom"])); + } + set { + this["HelpZoom"] = value; + } + } + } +//} diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindowSettings.settings b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindowSettings.settings new file mode 100644 index 00000000000..4de65371758 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindowSettings.settings @@ -0,0 +1,60 @@ + + + + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + False + + + False + + + -1 + + + -1 + + + False + + + 100 + + + 500 + + + 700 + + + True + + + \ No newline at end of file diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/ParagraphBuilder.cs b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/ParagraphBuilder.cs new file mode 100644 index 00000000000..3bb9cf7c83c --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/ParagraphBuilder.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Text; +using System.Windows.Documents; +using System.Windows.Media; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Builds a paragraph based on Text + Bold + Highlight information. + /// Bold are the segments of thexct that should be bold, and Highlight are + /// the segments of thext that should be highlighted (like search results). + /// + internal class ParagraphBuilder : INotifyPropertyChanged + { + /// + /// The text spans that should be bold + /// + private List boldSpans; + + /// + /// The text spans that should be highlighted + /// + private List highlighedSpans; + + /// + /// The text displayed + /// + private StringBuilder textBuilder; + + /// + /// Paragraph built in BuildParagraph + /// + private Paragraph paragraph; + + /// + /// Initializes a new instance of the ParagraphBuilder class + /// + /// paragraph we will be adding lines to in BuildParagraph + internal ParagraphBuilder(Paragraph paragraph) + { + if (paragraph == null) + { + throw new ArgumentNullException("paragraph"); + } + + this.paragraph = paragraph; + this.boldSpans = new List(); + this.highlighedSpans = new List(); + this.textBuilder = new StringBuilder(); + } + + #region INotifyPropertyChanged Members + /// + /// Used to notify of property changes + /// + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + /// + /// Gets the number of highlights. + /// + internal int HighlightCount + { + get { return this.highlighedSpans.Count; } + } + + /// + /// Gets the paragraph built in BuildParagraph + /// + internal Paragraph Paragraph + { + get { return this.paragraph; } + } + + /// + /// Called after all the AddText calls have been made to build the paragraph + /// based on the current text. + /// This method goes over 3 collections simultaneouslly: + /// 1) characters in this.textBuilder + /// 2) spans in this.boldSpans + /// 3) spans in this.highlightedSpans + /// And adds the minimal number of Inlines to the paragraph so that all + /// characters that should be bold and/or highlighed are. + /// + internal void BuildParagraph() + { + this.paragraph.Inlines.Clear(); + + int currentBoldIndex = 0; + TextSpan? currentBoldSpan = this.boldSpans.Count == 0 ? (TextSpan?)null : this.boldSpans[0]; + int currentHighlightedIndex = 0; + TextSpan? currentHighlightedSpan = this.highlighedSpans.Count == 0 ? (TextSpan?)null : this.highlighedSpans[0]; + + bool currentBold = false; + bool currentHighlighted = false; + + StringBuilder sequence = new StringBuilder(); + int i = 0; + foreach (char c in this.textBuilder.ToString()) + { + bool newBold = false; + bool newHighlighted = false; + + ParagraphBuilder.MoveSpanToPosition(ref currentBoldIndex, ref currentBoldSpan, i, this.boldSpans); + newBold = currentBoldSpan == null ? false : currentBoldSpan.Value.Contains(i); + + ParagraphBuilder.MoveSpanToPosition(ref currentHighlightedIndex, ref currentHighlightedSpan, i, this.highlighedSpans); + newHighlighted = currentHighlightedSpan == null ? false : currentHighlightedSpan.Value.Contains(i); + + if (newBold != currentBold || newHighlighted != currentHighlighted) + { + ParagraphBuilder.AddInline(this.paragraph, currentBold, currentHighlighted, sequence); + } + + sequence.Append(c); + + currentHighlighted = newHighlighted; + currentBold = newBold; + i++; + } + + ParagraphBuilder.AddInline(this.paragraph, currentBold, currentHighlighted, sequence); + } + + /// + /// Highlights all ocurrences of . + /// This is called after all calls to AddText have been made + /// + /// search string + /// true if search should be case sensitive + /// true if we should search whole word only + internal void HighlightAllInstancesOf(string search, bool caseSensitive, bool wholeWord) + { + this.highlighedSpans.Clear(); + + if (search == null || search.Trim().Length == 0) + { + this.BuildParagraph(); + this.OnNotifyPropertyChanged("HighlightCount"); + return; + } + + string text = this.textBuilder.ToString(); + StringComparison comparison = caseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; + int start = 0; + int match; + while ((match = text.IndexOf(search, start, comparison)) != -1) + { + // false loop + do + { + if (wholeWord) + { + if (match > 0 && Char.IsLetterOrDigit(text[match - 1])) + { + break; + } + + if ((match + search.Length <= text.Length - 1) && Char.IsLetterOrDigit(text[match + search.Length])) + { + break; + } + } + + this.AddHighlight(match, search.Length); + } + while (false); + + start = match + search.Length; + } + + this.BuildParagraph(); + this.OnNotifyPropertyChanged("HighlightCount"); + } + + /// + /// Adds text to the paragraph later build with BuildParagraph + /// + /// text to be added + /// true if the text should be bold + internal void AddText(string str, bool bold) + { + if (str == null) + { + throw new ArgumentNullException("str"); + } + + if (str.Length == 0) + { + return; + } + + if (bold) + { + this.boldSpans.Add(new TextSpan(this.textBuilder.Length, str.Length)); + } + + this.textBuilder.Append(str); + } + + /// + /// Called before a derived class starts adding text + /// to reset the current content + /// + internal void ResetAllText() + { + this.boldSpans.Clear(); + this.highlighedSpans.Clear(); + this.textBuilder.Clear(); + } + + /// + /// Adds an inline to based on the remaining parameters. + /// + /// paragraph to add Inline to + /// true if text should be added in bold + /// true if the text should be added with highlight + /// the text to add and clear + private static void AddInline(Paragraph currentParagraph, bool currentBold, bool currentHighlighted, StringBuilder sequence) + { + if (sequence.Length == 0) + { + return; + } + + Run run = new Run(sequence.ToString()); + if (currentHighlighted) + { + run.Background = ParagraphSearcher.HighlightBrush; + } + + Inline inline = currentBold ? (Inline)new Bold(run) : run; + currentParagraph.Inlines.Add(inline); + sequence.Clear(); + } + + /// + /// This is an auxiliar method in BuildParagraph to move the current bold or highlighed spans + /// according to the + /// The current bold and higlighed span should be ending ahead of the current position. + /// Moves and to the + /// propper span in according to the + /// This is an auxiliar method in BuildParagraph. + /// + /// current index within + /// current span within + /// caracter position. This comes from a position within this.textBuilder + /// the collection of spans. This is either this.boldSpans or this.highlightedSpans + private static void MoveSpanToPosition(ref int currentSpanIndex, ref TextSpan? currentSpan, int caracterPosition, List allSpans) + { + if (currentSpan == null || caracterPosition <= currentSpan.Value.End) + { + return; + } + + for (int newBoldIndex = currentSpanIndex + 1; newBoldIndex < allSpans.Count; newBoldIndex++) + { + TextSpan newBoldSpan = allSpans[newBoldIndex]; + if (caracterPosition <= newBoldSpan.End) + { + currentSpanIndex = newBoldIndex; + currentSpan = newBoldSpan; + return; + } + } + + // there is no span ending ahead of current position, so + // we set the current span to null to prevent unecessary comparisons against the currentSpan + currentSpan = null; + } + + /// + /// Adds one individual text highlight + /// This is called after all calls to AddText have been made + /// + /// highlight start + /// highlight length + private void AddHighlight(int start, int length) + { + if (start < 0) + { + throw new ArgumentOutOfRangeException("start"); + } + + if (start + length > this.textBuilder.Length) + { + throw new ArgumentOutOfRangeException("length"); + } + + this.highlighedSpans.Add(new TextSpan(start, length)); + } + + /// + /// Called internally to notify when a proiperty changed + /// + /// property name + private void OnNotifyPropertyChanged(string propertyName) + { + PropertyChangedEventHandler handler = this.PropertyChanged; + if (handler != null) + { + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// A text span used to mark bold and highlighed segments + /// + internal struct TextSpan + { + /// + /// Index of the first character in the span + /// + private int start; + + /// + /// Index of the last character in the span + /// + private int end; + + /// + /// Initializes a new instance of the TextSpan struct + /// + /// Index of the first character in the span + /// Index of the last character in the span + internal TextSpan(int start, int length) + { + if (start < 0) + { + throw new ArgumentOutOfRangeException("start"); + } + + if (length < 1) + { + throw new ArgumentOutOfRangeException("length"); + } + + this.start = start; + this.end = start + length - 1; + } + + /// + /// Gets the index of the first character in the span + /// + internal int Start + { + get { return this.start; } + } + + /// + /// Gets the index of the first character in the span + /// + internal int End + { + get + { + return this.end; + } + } + + /// + /// Returns true if the is between start and end (inclusive) + /// + /// position to verify if is in the span + /// true if the is between start and end (inclusive) + internal bool Contains(int position) + { + return (position >= this.start) && (position <= this.end); + } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/ParagraphSearcher.cs b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/ParagraphSearcher.cs new file mode 100644 index 00000000000..e1e8a1b2b6f --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/ParagraphSearcher.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Diagnostics; +using System.Windows.Documents; +using System.Windows.Media; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Moves through search highlights built in a ParagraphBuilder + /// changing the color of the current highlight + /// + internal class ParagraphSearcher + { + /// + /// Highlight for all matches except the current + /// + internal static readonly Brush HighlightBrush = Brushes.Yellow; + + /// + /// Highlight for the current match + /// + private static readonly Brush CurrentHighlightBrush = Brushes.Cyan; + + /// + /// Current match being highlighted in search + /// + private Run currentHighlightedMatch; + + /// + /// Initializes a new instance of the ParagraphSearcher class + /// + internal ParagraphSearcher() + { + } + + /// + /// Move to the next highlight starting at the + /// + /// true for next false for previous + /// caret position + /// the next highlight starting at the + internal Run MoveAndHighlightNextNextMatch(bool forward, TextPointer caretPosition) + { + Debug.Assert(caretPosition != null, "a caret position is allways valid"); + Debug.Assert(caretPosition.Parent != null && caretPosition.Parent is Run, "a caret PArent is allways a valid Run"); + Run caretRun = (Run)caretPosition.Parent; + + Run currentRun; + + if (this.currentHighlightedMatch != null) + { + // restore the curent highlighted background to plain highlighted + this.currentHighlightedMatch.Background = ParagraphSearcher.HighlightBrush; + } + + // If the caret is in the end of a highlight we move to the adjacent run + // It has to be in the end because if there is a match at the begining of the file + // and the caret has not been touched (so it is in the beginning of the file too) + // we want to highlight this first match. + // Considering the caller allways set the caret to the end of the highlight + // The condition below works well for successive searchs + // We also need to move to the adjacent run if the caret is at the first run and we + // are moving backwards so that a search backwards when the first run is highlighted + // and the caret is at the beginning will wrap to the end + if ((!forward && IsFirstRun(caretRun)) || + ((caretPosition.GetOffsetToPosition(caretRun.ContentEnd) == 0) && ParagraphSearcher.Ishighlighted(caretRun))) + { + currentRun = ParagraphSearcher.GetNextRun(caretRun, forward); + } + else + { + currentRun = caretRun; + } + + currentRun = ParagraphSearcher.GetNextMatch(currentRun, forward); + + if (currentRun == null) + { + // if we could not find a next highlight wrap arround + currentRun = ParagraphSearcher.GetFirstOrLastRun(caretRun, forward); + currentRun = ParagraphSearcher.GetNextMatch(currentRun, forward); + } + + this.currentHighlightedMatch = currentRun; + if (this.currentHighlightedMatch != null) + { + // restore the curent highligthed background to current highlighted + this.currentHighlightedMatch.Background = ParagraphSearcher.CurrentHighlightBrush; + } + + return currentRun; + } + + /// + /// Resets the search for fresh calls to MoveAndHighlightNextNextMatch + /// + internal void ResetSearch() + { + this.currentHighlightedMatch = null; + } + + /// + /// Returns true if is highlighted + /// + /// run to check if is highlighted + /// true if is highlighted + private static bool Ishighlighted(Run run) + { + if (run == null) + { + return false; + } + + SolidColorBrush background = run.Background as SolidColorBrush; + if (background != null && background == ParagraphSearcher.HighlightBrush) + { + return true; + } + + return false; + } + + /// + /// Get the next or previous run according to + /// + /// the current run + /// true for next false for previous + /// the next or previous run according to + private static Run GetNextRun(Run currentRun, bool forward) + { + Bold parentBold = currentRun.Parent as Bold; + + Inline nextInline; + + if (forward) + { + nextInline = parentBold != null ? ((Inline)parentBold).NextInline : currentRun.NextInline; + } + else + { + nextInline = parentBold != null ? ((Inline)parentBold).PreviousInline : currentRun.PreviousInline; + } + + return GetRun(nextInline); + } + + /// + /// Gets the run of an inline. Inlines in a ParagrahBuilder are either a Run or a Bold + /// which contains a Run + /// + /// inline to get the run from + /// the run of the inline + private static Run GetRun(Inline inline) + { + Bold inlineBold = inline as Bold; + if (inlineBold != null) + { + return (Run)inlineBold.Inlines.FirstInline; + } + + return (Run)inline; + } + + /// + /// Gets the next highlighted run starting and including + /// according to the direction specified in + /// + /// the current run + /// true for next false for previous + /// + /// the next highlighted run starting and including + /// according to the direction specified in + /// + private static Run GetNextMatch(Run currentRun, bool forward) + { + while (currentRun != null) + { + if (ParagraphSearcher.Ishighlighted(currentRun)) + { + return currentRun; + } + + currentRun = ParagraphSearcher.GetNextRun(currentRun, forward); + } + + return currentRun; + } + + /// + /// Gets the run's paragraph + /// + /// run to get the paragraph from + /// the run's paragraph + private static Paragraph GetParagraph(Run run) + { + Bold parentBold = run.Parent as Bold; + Paragraph parentParagraph = (parentBold != null ? parentBold.Parent : run.Parent) as Paragraph; + Debug.Assert(parentParagraph != null, "the documents we are saerching are built with ParagraphBuilder, which builds the document like this"); + return parentParagraph; + } + + /// + /// Returns true if the run is the fiorst run of the paragraph + /// + /// run to check + /// true if the run is the fiorst run of the paragraph + private static bool IsFirstRun(Run run) + { + Paragraph paragraph = GetParagraph(run); + Run firstRun = ParagraphSearcher.GetRun(paragraph.Inlines.FirstInline); + return run == firstRun; + } + + /// + /// Gets the first or lasr run in the paragraph containing + /// + /// run containing the caret + /// true for first false for last + /// the first or last run in the paragraph containing + private static Run GetFirstOrLastRun(Run caretRun, bool forward) + { + Debug.Assert(caretRun != null, "a caret run is allways valid"); + + Paragraph paragraph = GetParagraph(caretRun); + + Inline firstOrLastInline; + if (forward) + { + firstOrLastInline = paragraph.Inlines.FirstInline; + } + else + { + firstOrLastInline = paragraph.Inlines.LastInline; + } + + return GetRun(firstOrLastInline); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/SettingsDialog.xaml b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/SettingsDialog.xaml new file mode 100644 index 00000000000..ad264c5ad34 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/SettingsDialog.xaml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/SettingsDialog.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/SettingsDialog.xaml.cs new file mode 100644 index 00000000000..538540bd575 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/SettingsDialog.xaml.cs @@ -0,0 +1,64 @@ +//----------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// +// Implements SettingsDialog. +// +//----------------------------------------------------------------------- + +namespace Microsoft.Management.UI +{ + using System.Windows; + using Microsoft.Management.UI.Internal; + + /// + /// Dialog with settings for the help dialog + /// + public partial class SettingsDialog : Window + { + /// + /// Initializes a new instance of the SettingsDialog class + /// + public SettingsDialog() + { + InitializeComponent(); + this.Description.IsChecked = HelpWindowSettings.Default.HelpDescriptionDisplayed; + this.Examples.IsChecked = HelpWindowSettings.Default.HelpExamplesDisplayed; + this.Inputs.IsChecked = HelpWindowSettings.Default.HelpInputsDisplayed; + this.Notes.IsChecked = HelpWindowSettings.Default.HelpNotesDisplayed; + this.Outputs.IsChecked = HelpWindowSettings.Default.HelpOutputsDisplayed; + this.Parameters.IsChecked = HelpWindowSettings.Default.HelpParametersDisplayed; + this.RelatedLinks.IsChecked = HelpWindowSettings.Default.HelpRelatedLinksDisplayed; + this.Remarks.IsChecked = HelpWindowSettings.Default.HelpRemarksDisplayed; + this.Synopsys.IsChecked = HelpWindowSettings.Default.HelpSynopsysDisplayed; + this.Syntax.IsChecked = HelpWindowSettings.Default.HelpSyntaxDisplayed; + this.CaseSensitive.IsChecked = HelpWindowSettings.Default.HelpSearchMatchCase; + this.WholeWord.IsChecked = HelpWindowSettings.Default.HelpSearchWholeWord; + } + + /// + /// Called when the OK button has been clicked + /// + /// event sender + /// event arguments + private void OK_Click(object sender, RoutedEventArgs e) + { + HelpWindowSettings.Default.HelpDescriptionDisplayed = this.Description.IsChecked == true; + HelpWindowSettings.Default.HelpExamplesDisplayed = this.Examples.IsChecked == true; + HelpWindowSettings.Default.HelpInputsDisplayed = this.Inputs.IsChecked == true; + HelpWindowSettings.Default.HelpOutputsDisplayed = this.Outputs.IsChecked == true; + HelpWindowSettings.Default.HelpNotesDisplayed = this.Notes.IsChecked == true; + HelpWindowSettings.Default.HelpParametersDisplayed = this.Parameters.IsChecked == true; + HelpWindowSettings.Default.HelpRelatedLinksDisplayed = this.RelatedLinks.IsChecked == true; + HelpWindowSettings.Default.HelpRemarksDisplayed = this.Remarks.IsChecked == true; + HelpWindowSettings.Default.HelpSynopsysDisplayed = this.Synopsys.IsChecked == true; + HelpWindowSettings.Default.HelpSyntaxDisplayed = this.Syntax.IsChecked == true; + HelpWindowSettings.Default.HelpSearchMatchCase = this.CaseSensitive.IsChecked == true; + HelpWindowSettings.Default.HelpSearchWholeWord = this.WholeWord.IsChecked == true; + HelpWindowSettings.Default.Save(); + this.DialogResult = true; + this.Close(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationButton.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationButton.cs new file mode 100644 index 00000000000..a59322aaedd --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationButton.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.Windows.Automation.Peers; +using System.Windows.Controls; +using System.Windows; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Provides a control that is always visible in the automation tree. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Description("Provides a System.Windows.Controls.Button control that is always visible in the automation tree.")] + public class AutomationButton : Button + { + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public AutomationButton() + { + // This constructor intentionally left blank + } + + #endregion + + #region Overides + + /// + /// Returns the implementations for this control. + /// + /// The implementations for this control. + protected override AutomationPeer OnCreateAutomationPeer() + { + return new AutomationButtonAutomationPeer(this); + } + + #endregion + } + + /// + /// Provides an automation peer for AutomationButton. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + internal class AutomationButtonAutomationPeer : ButtonAutomationPeer + { + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The owner of the automation peer. + public AutomationButtonAutomationPeer(Button owner) + : base(owner) + { + // This constructor intentionally left blank + } + + #endregion + + #region Overrides + + /// + /// Gets a value that indicates whether the element is understood by the user as interactive or as contributing to the logical structure of the control in the GUI. Called by IsControlElement(). + /// + /// This method always returns false. + protected override bool IsControlElementCore() + { + return (this.Owner.Visibility != Visibility.Hidden); + } + + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationImage.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationImage.cs new file mode 100644 index 00000000000..d542ee0654f --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationImage.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.Windows.Automation.Peers; +using System.Windows.Controls; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Provides a control that is always visible in the automation tree. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Description("Provides a System.Windows.Controls.Image control that is always visible in the automation tree.")] + public class AutomationImage : Image + { + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public AutomationImage() + { + // This constructor intentionally left blank + } + + #endregion + + #region Overides + + /// + /// Returns the implementations for this control. + /// + /// The implementations for this control. + protected override AutomationPeer OnCreateAutomationPeer() + { + return new AutomationImageAutomationPeer(this); + } + + #endregion + } + + /// + /// Provides an automation peer for AutomationImage. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + internal class AutomationImageAutomationPeer : ImageAutomationPeer + { + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + /// The owner of the automation peer. + public AutomationImageAutomationPeer(Image owner) + : base(owner) + { + // This constructor intentionally left blank + } + + #endregion + + #region Overrides + + /// + /// Gets a value that indicates whether the element is understood by the user as interactive or as contributing to the logical structure of the control in the GUI. Called by IsControlElement(). + /// + /// This method always returns false. + protected override bool IsControlElementCore() + { + return false; + } + + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationTextBlock.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationTextBlock.cs new file mode 100644 index 00000000000..44fbd38dff4 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationTextBlock.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.Windows.Automation.Peers; +using System.Windows.Controls; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Provides a control that is always visible in the automation tree. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + [Description("Provides a System.Windows.Controls.TextBlock control that is always visible in the automation tree.")] + public class AutomationTextBlock : TextBlock + { + #region Structors + + /// + /// Initializes a new instance of the class. + /// + public AutomationTextBlock() + { + // This constructor intentionally left blank + } + + #endregion + + #region Overides + + /// + /// Returns the implementations for this control. + /// + /// The implementations for this control. + protected override AutomationPeer OnCreateAutomationPeer() + { + return new AutomationTextBlockAutomationPeer(this); + } + + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationTextBlockAutomationPeer.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationTextBlockAutomationPeer.cs new file mode 100644 index 00000000000..79950b95b4e --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/AutomationTextBlockAutomationPeer.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Diagnostics.CodeAnalysis; +using System.Windows.Automation.Peers; +using System.Windows.Controls; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Provides an automation peer for AutomationTextBlock. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + internal class AutomationTextBlockAutomationPeer : TextBlockAutomationPeer + { + #region Structors + + /// + /// Initializes a new instance of the class. + /// + /// The owner of the automation peer. + public AutomationTextBlockAutomationPeer(TextBlock owner) + : base(owner) + { + // This constructor intentionally left blank + } + + #endregion + + #region Overrides + + /// + /// Gets a value that indicates whether the element is understood by the user as interactive or as contributing to the logical structure of the control in the GUI. Called by IsControlElement(). + /// + /// This method always returns true. + protected override bool IsControlElementCore() + { + return true; + } + + /// + /// Gets the class name. + /// + /// The class name. + protected override string GetClassNameCore() + { + return this.Owner.GetType().Name; + } + + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/BooleanBoxes.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/BooleanBoxes.cs new file mode 100644 index 00000000000..f20d6314860 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/BooleanBoxes.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Microsoft.Management.UI.Internal +{ + + /// + /// A class which returns the same boxed bool values. + /// + internal static class BooleanBoxes + { + private static object trueBox = true; + private static object falseBox = false; + + internal static object TrueBox + { + get + { + return trueBox; + } + } + + internal static object FalseBox + { + get + { + return falseBox; + } + } + + internal static object Box(bool value) + { + if (value) + { + return TrueBox; + } + else + { + return FalseBox; + } + } + } + +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/CommandHelper.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/CommandHelper.cs new file mode 100644 index 00000000000..9399d14d8c3 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/CommandHelper.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Input; +using System.Security; + +namespace Microsoft.Management.UI.Internal +{ + internal static class CommandHelper + { + internal static void ExecuteCommand(ICommand command, object parameter, IInputElement target) + { + RoutedCommand command2 = command as RoutedCommand; + if (command2 != null) + { + if (command2.CanExecute(parameter, target)) + { + command2.Execute(parameter, target); + } + } + else if (command.CanExecute(parameter)) + { + command.Execute(parameter); + } + } + + internal static bool CanExecuteCommand(ICommand command, object parameter, IInputElement target) + { + if (command == null) + { + return false; + } + + RoutedCommand command2 = command as RoutedCommand; + + if (command2 != null) + { + return command2.CanExecute(parameter, target); + } + else + { + return command.CanExecute(parameter); + } + } + } +} + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/CustomTypeComparer.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/CustomTypeComparer.cs new file mode 100644 index 00000000000..81db96f05a7 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/CustomTypeComparer.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Diagnostics; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// The CustomTypeComparer is responsible for holding custom comparers + /// for different types, which are in turn used to perform comparison + /// operations instead of the default IComparable comparison. + /// with a custom comparer + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public static class CustomTypeComparer + { + private static Dictionary comparers = new Dictionary(); + + /// + /// The static constructor. + /// + static CustomTypeComparer() + { + comparers.Add(typeof(DateTime), new DateTimeApproximationComparer()); + } + + /// + /// Compares two objects and returns a value indicating + /// whether one is less than, equal to, or greater than the other. + /// + /// + /// The first object to compare. + /// + /// + /// The second object to compare. + /// + /// + /// A type implementing IComparable. + /// + /// + /// If value1 is less than value2, then a value less than zero is returned. + /// If value1 equals value2, than zero is returned. + /// If value1 is greater than value2, then a value greater than zero is returned. + /// + public static int Compare(T value1, T value2) where T : IComparable + { + IComparer comparer; + if (false == TryGetCustomComparer(out comparer)) + { + return value1.CompareTo(value2); + } + + return comparer.Compare(value1, value2); + } + + private static bool TryGetCustomComparer(out IComparer comparer) where T : IComparable + { + comparer = null; + + object uncastComparer = null; + if (false == comparers.TryGetValue(typeof(T), out uncastComparer)) + { + return false; + } + + Debug.Assert(uncastComparer is IComparer); + comparer = (IComparer)uncastComparer; + + return true; + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DataRoutedEventArgs.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DataRoutedEventArgs.cs new file mode 100644 index 00000000000..efcb5bb6ad4 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DataRoutedEventArgs.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Routed event args which provide the ability to attach an + /// arbitrary peice of data. + /// + /// There are no restrictions on type T. + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public class DataRoutedEventArgs : RoutedEventArgs + { + private T data; + + /// + /// Constructs a new instance of the DataRoutedEventArgs class. + /// + /// The data payload to be stored. + /// The routed event. + public DataRoutedEventArgs(T data, RoutedEvent routedEvent) + { + this.data = data; + this.RoutedEvent = routedEvent; + } + + /// + /// Gets a value containing the data being stored. + /// + public T Data + { + get { return this.data; } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DateTimeApproximationComparer.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DateTimeApproximationComparer.cs new file mode 100644 index 00000000000..c572ed1b3f3 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DateTimeApproximationComparer.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// The DateTimeApproximationComparer is responsible for comparing two + /// DateTime objects at a level of precision determined by + /// the first object. The comparison either compares at the + /// date level or the date and time (down to Seconds precision). + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public class DateTimeApproximationComparer : IComparer + { + /// + /// Compares two objects and returns a value indicating + /// whether one is less than, equal to, or greater than the other. + /// + /// + /// The first object to compare. + /// + /// + /// The second object to compare. + /// + /// + /// If value1 is less than value2, then a value less than zero is returned. + /// If value1 equals value2, than zero is returned. + /// If value1 is greater than value2, then a value greater than zero is returned. + /// + public int Compare(DateTime value1, DateTime value2) + { + DateTime roundedX; + DateTime roundedY; + GetRoundedValues(value1, value2, out roundedX, out roundedY); + + return roundedX.CompareTo(roundedY); + } + + private static void GetRoundedValues(DateTime value1, DateTime value2, out DateTime roundedValue1, out DateTime roundedValue2) + { + roundedValue1 = value1; + roundedValue2 = value2; + + bool hasTimeComponent = HasTimeComponent(value1); + + int hour = hasTimeComponent ? value1.Hour : value2.Hour; + int minute = hasTimeComponent ? value1.Minute : value2.Minute; + int second = hasTimeComponent ? value1.Second : value2.Second; + + roundedValue1 = new DateTime(value1.Year, value1.Month, value1.Day, hour, minute, second); + roundedValue2 = new DateTime(value2.Year, value2.Month, value2.Day, value2.Hour, value2.Minute, value2.Second); + } + + private static bool HasTimeComponent(DateTime value) + { + bool hasNoTimeComponent = true + && 0 == value.Hour + && 0 == value.Minute + && 0 == value.Second + && 0 == value.Millisecond; + + return (!hasNoTimeComponent); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DismissiblePopup.Generated.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DismissiblePopup.Generated.cs new file mode 100644 index 00000000000..c0a89bc1c41 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DismissiblePopup.Generated.cs @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#region StyleCop Suppression - generated code +using System; +using System.ComponentModel; +using System.Windows; +using System.Windows.Input; + +namespace Microsoft.Management.UI.Internal +{ + + /// + /// A popup which child controls can signal to be dimissed. + /// + /// + /// If a control wants to dismiss the popup then they should execute the DismissPopupCommand on a target in the popup window. + /// + [Localizability(LocalizationCategory.None)] + partial class DismissiblePopup + { + // + // DismissPopup routed command + // + /// + /// A command which child controls can use to tell the popup to close. + /// + public static readonly RoutedCommand DismissPopupCommand = new RoutedCommand("DismissPopup",typeof(DismissiblePopup)); + + static private void DismissPopupCommand_CommandExecuted(object sender, ExecutedRoutedEventArgs e) + { + DismissiblePopup obj = (DismissiblePopup) sender; + obj.OnDismissPopupExecuted( e ); + } + + /// + /// Called when DismissPopup executes. + /// + /// + /// A command which child controls can use to tell the popup to close. + /// + protected virtual void OnDismissPopupExecuted(ExecutedRoutedEventArgs e) + { + OnDismissPopupExecutedImplementation(e); + } + + partial void OnDismissPopupExecutedImplementation(ExecutedRoutedEventArgs e); + + // + // CloseOnEscape dependency property + // + /// + /// Identifies the CloseOnEscape dependency property. + /// + public static readonly DependencyProperty CloseOnEscapeProperty = DependencyProperty.Register( "CloseOnEscape", typeof(bool), typeof(DismissiblePopup), new PropertyMetadata( BooleanBoxes.TrueBox, CloseOnEscapeProperty_PropertyChanged) ); + + /// + /// Gets or sets a value indicating whether the popup closes when ESC is pressed. + /// + [Bindable(true)] + [Category("Common Properties")] + [Description("Gets or sets a value indicating whether the popup closes when ESC is pressed.")] + [Localizability(LocalizationCategory.None)] + public bool CloseOnEscape + { + get + { + return (bool) GetValue(CloseOnEscapeProperty); + } + set + { + SetValue(CloseOnEscapeProperty,BooleanBoxes.Box(value)); + } + } + + static private void CloseOnEscapeProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + DismissiblePopup obj = (DismissiblePopup) o; + obj.OnCloseOnEscapeChanged( new PropertyChangedEventArgs((bool)e.OldValue, (bool)e.NewValue) ); + } + + /// + /// Occurs when CloseOnEscape property changes. + /// + public event EventHandler> CloseOnEscapeChanged; + + /// + /// Called when CloseOnEscape property changes. + /// + protected virtual void OnCloseOnEscapeChanged(PropertyChangedEventArgs e) + { + OnCloseOnEscapeChangedImplementation(e); + RaisePropertyChangedEvent(CloseOnEscapeChanged, e); + } + + partial void OnCloseOnEscapeChangedImplementation(PropertyChangedEventArgs e); + + // + // FocusChildOnOpen dependency property + // + /// + /// Identifies the FocusChildOnOpen dependency property. + /// + public static readonly DependencyProperty FocusChildOnOpenProperty = DependencyProperty.Register( "FocusChildOnOpen", typeof(bool), typeof(DismissiblePopup), new PropertyMetadata( BooleanBoxes.TrueBox, FocusChildOnOpenProperty_PropertyChanged) ); + + /// + /// Gets or sets a value indicating whether focus should be set on the child when the popup opens. + /// + [Bindable(true)] + [Category("Common Properties")] + [Description("Gets or sets a value indicating whether focus should be set on the child when the popup opens.")] + [Localizability(LocalizationCategory.None)] + public bool FocusChildOnOpen + { + get + { + return (bool) GetValue(FocusChildOnOpenProperty); + } + set + { + SetValue(FocusChildOnOpenProperty,BooleanBoxes.Box(value)); + } + } + + static private void FocusChildOnOpenProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + DismissiblePopup obj = (DismissiblePopup) o; + obj.OnFocusChildOnOpenChanged( new PropertyChangedEventArgs((bool)e.OldValue, (bool)e.NewValue) ); + } + + /// + /// Occurs when FocusChildOnOpen property changes. + /// + public event EventHandler> FocusChildOnOpenChanged; + + /// + /// Called when FocusChildOnOpen property changes. + /// + protected virtual void OnFocusChildOnOpenChanged(PropertyChangedEventArgs e) + { + OnFocusChildOnOpenChangedImplementation(e); + RaisePropertyChangedEvent(FocusChildOnOpenChanged, e); + } + + partial void OnFocusChildOnOpenChangedImplementation(PropertyChangedEventArgs e); + + // + // SetFocusOnClose dependency property + // + /// + /// Identifies the SetFocusOnClose dependency property. + /// + public static readonly DependencyProperty SetFocusOnCloseProperty = DependencyProperty.Register( "SetFocusOnClose", typeof(bool), typeof(DismissiblePopup), new PropertyMetadata( BooleanBoxes.FalseBox, SetFocusOnCloseProperty_PropertyChanged) ); + + /// + /// Indicates whether the focus returns to either a defined by the FocusOnCloseTarget dependency property UIElement or PlacementTarget or not. + /// + [Bindable(true)] + [Category("Common Properties")] + [Description("Indicates whether the focus returns to either a defined by the FocusOnCloseTarget dependency property UIElement or PlacementTarget or not.")] + [Localizability(LocalizationCategory.None)] + public bool SetFocusOnClose + { + get + { + return (bool) GetValue(SetFocusOnCloseProperty); + } + set + { + SetValue(SetFocusOnCloseProperty,BooleanBoxes.Box(value)); + } + } + + static private void SetFocusOnCloseProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + DismissiblePopup obj = (DismissiblePopup) o; + obj.OnSetFocusOnCloseChanged( new PropertyChangedEventArgs((bool)e.OldValue, (bool)e.NewValue) ); + } + + /// + /// Occurs when SetFocusOnClose property changes. + /// + public event EventHandler> SetFocusOnCloseChanged; + + /// + /// Called when SetFocusOnClose property changes. + /// + protected virtual void OnSetFocusOnCloseChanged(PropertyChangedEventArgs e) + { + OnSetFocusOnCloseChangedImplementation(e); + RaisePropertyChangedEvent(SetFocusOnCloseChanged, e); + } + + partial void OnSetFocusOnCloseChangedImplementation(PropertyChangedEventArgs e); + + // + // SetFocusOnCloseElement dependency property + // + /// + /// Identifies the SetFocusOnCloseElement dependency property. + /// + public static readonly DependencyProperty SetFocusOnCloseElementProperty = DependencyProperty.Register( "SetFocusOnCloseElement", typeof(UIElement), typeof(DismissiblePopup), new PropertyMetadata( null, SetFocusOnCloseElementProperty_PropertyChanged) ); + + /// + /// If the SetFocusOnClose property is set True and this property is set to a valid UIElement, focus returns to this UIElement after the DismissiblePopup is closed. + /// + [Bindable(true)] + [Category("Common Properties")] + [Description("If the SetFocusOnClose property is set True and this property is set to a valid UIElement, focus returns to this UIElement after the DismissiblePopup is closed.")] + [Localizability(LocalizationCategory.None)] + public UIElement SetFocusOnCloseElement + { + get + { + return (UIElement) GetValue(SetFocusOnCloseElementProperty); + } + set + { + SetValue(SetFocusOnCloseElementProperty,value); + } + } + + static private void SetFocusOnCloseElementProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + DismissiblePopup obj = (DismissiblePopup) o; + obj.OnSetFocusOnCloseElementChanged( new PropertyChangedEventArgs((UIElement)e.OldValue, (UIElement)e.NewValue) ); + } + + /// + /// Occurs when SetFocusOnCloseElement property changes. + /// + public event EventHandler> SetFocusOnCloseElementChanged; + + /// + /// Called when SetFocusOnCloseElement property changes. + /// + protected virtual void OnSetFocusOnCloseElementChanged(PropertyChangedEventArgs e) + { + OnSetFocusOnCloseElementChangedImplementation(e); + RaisePropertyChangedEvent(SetFocusOnCloseElementChanged, e); + } + + partial void OnSetFocusOnCloseElementChangedImplementation(PropertyChangedEventArgs e); + + /// + /// Called when a property changes. + /// + private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) + { + if(eh != null) + { + eh(this,e); + } + } + + // + // Static constructor + // + + /// + /// Called when the type is initialized. + /// + static DismissiblePopup() + { + CommandManager.RegisterClassCommandBinding( typeof(DismissiblePopup), new CommandBinding( DismissiblePopup.DismissPopupCommand, DismissPopupCommand_CommandExecuted )); + StaticConstructorImplementation(); + } + + static partial void StaticConstructorImplementation(); + + } +} +#endregion diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DismissiblePopup.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DismissiblePopup.cs new file mode 100644 index 00000000000..10ec3f10931 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/DismissiblePopup.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Diagnostics; +using System.Windows; +using System.Windows.Automation; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Data; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Partial class implementation for DismissiblePopup control. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public partial class DismissiblePopup : Popup + { + /// + /// Constructs an instance of DismissablePopup. + /// + public DismissiblePopup() : base() + { + // nothing + } + + private delegate void FocusChildDelegate(); + + /// + /// Responds to the condition in which the value of the IsOpen property changes from false to true. + /// + /// The event arguments. + protected override void OnOpened(EventArgs e) + { + base.OnOpened(e); + + if (this.FocusChildOnOpen) + { + this.Dispatcher.BeginInvoke( + System.Windows.Threading.DispatcherPriority.Loaded, + new FocusChildDelegate(this.FocusChild)); + } + + this.SetupAutomationIdBinding(); + } + + + /// + /// Responds when the value of the IsOpen property changes from to true to false. + /// + /// The event arguments. + protected override void OnClosed(EventArgs e) + { + base.OnClosed(e); + + if (this.SetFocusOnClose) + { + // Find a control to set focus on. + if (this.SetFocusOnCloseElement != null) + { + // The focus target is set explicitly. + this.SetFocus(this.SetFocusOnCloseElement); + } + else if (this.PlacementTarget != null) + { + // Use PlacementTarget as a first chance option. + this.SetFocus(this.PlacementTarget); + } + else + { + // Use parent UIObject when neither FocusOnCloseTarget nor PlacementTarget is set. + UIElement parent = this.Parent as UIElement; + if (parent != null) + { + this.SetFocus(parent); + } + } + } + } + + private void SetFocus(UIElement element) + { + if (element.Focusable) + { + element.Focus(); + } + else + { + element.MoveFocus(new TraversalRequest(FocusNavigationDirection.First)); + } + } + + private void SetupAutomationIdBinding() + { + var popupRoot = this.FindPopupRoot(); + + var binding = new Binding(); + binding.Source = this; + binding.Path = new PropertyPath(AutomationProperties.AutomationIdProperty); + popupRoot.SetBinding(AutomationProperties.AutomationIdProperty, binding); + } + + private FrameworkElement FindPopupRoot() + { + DependencyObject element = this.Child; + + while (false == element.GetType().Name.Equals("PopupRoot", StringComparison.Ordinal)) + { + element = VisualTreeHelper.GetParent( element ); + } + + Debug.Assert(element != null ); + + return (FrameworkElement) element; + } + + /// + /// Provides class handling for the KeyDown routed event that occurs when the user presses a key while this control has focus. + /// + /// The event data. + protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e) + { + //// + // Close the popup if ESC is pressed + //// + if (e.Key == System.Windows.Input.Key.Escape && this.CloseOnEscape) + { + this.IsOpen = false; + } + else + { + base.OnKeyDown(e); + } + } + + partial void OnDismissPopupExecutedImplementation(ExecutedRoutedEventArgs e) + { + this.IsOpen = false; + } + + private void FocusChild() + { + if (this.Child != null) + { + this.Child.MoveFocus(new TraversalRequest(FocusNavigationDirection.First)); + } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ExtendedFrameworkElementAutomationPeer.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ExtendedFrameworkElementAutomationPeer.cs new file mode 100644 index 00000000000..1670e7bbc6e --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ExtendedFrameworkElementAutomationPeer.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Diagnostics.CodeAnalysis; +using System.Windows; +using System.Windows.Automation.Peers; +using System.Windows.Controls; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Provides a base automation peer for FrameworkElement controls. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public class ExtendedFrameworkElementAutomationPeer : FrameworkElementAutomationPeer + { + #region Fields + + /// + /// Gets or sets the control type of the element that is associated with this automation peer. + /// + private AutomationControlType controlType = AutomationControlType.Custom; + + /// + /// Gets or sets a value that indicates whether the control should show in the logical tree. + /// + private bool isControlElement = true; + + #endregion + + #region Structors + + /// + /// Initializes a new instance of the class. + /// + /// The owner of the automation peer. + public ExtendedFrameworkElementAutomationPeer(FrameworkElement owner) + : base(owner) + { + // This constructor intentionally left blank + } + + /// + /// Initializes a new instance of the class. + /// + /// The owner of the automation peer. + /// The control type of the element that is associated with the automation peer. + public ExtendedFrameworkElementAutomationPeer(FrameworkElement owner, AutomationControlType controlType) + : this(owner) + { + this.controlType = controlType; + } + + /// + /// Initializes a new instance of the class. + /// + /// The owner of the automation peer. + /// The control type of the element that is associated with the automation peer. + /// Whether the element should show in the logical tree. + public ExtendedFrameworkElementAutomationPeer(FrameworkElement owner, AutomationControlType controlType, bool isControlElement) + : this(owner, controlType) + { + this.isControlElement = isControlElement; + } + + #endregion + + #region Overrides + + /// + /// Gets the class name. + /// + /// The class name. + protected override string GetClassNameCore() + { + return this.Owner.GetType().Name; + } + + /// + /// Gets the control type of the element that is associated with the automation peer. + /// + /// Returns the control type of the element that is associated with the automation peer. + protected override AutomationControlType GetAutomationControlTypeCore() + { + return this.controlType; + } + + /// + /// Gets a value that indicates whether the element is understood by the user as interactive or as contributing to the logical structure of the control in the GUI. Called by IsControlElement(). + /// + /// This method always returns true. + protected override bool IsControlElementCore() + { + return this.isControlElement; + } + + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IAsyncProgress.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IAsyncProgress.cs new file mode 100644 index 00000000000..920f2b07c91 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IAsyncProgress.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Collections.Generic; +using System.Text; +using System.Windows; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// An interface designed to provide updates about an asynchronous operation. + /// If the UI is data bound to the properties in this interface then INotifyPropertyChanged should + /// be implemented by the type implementing IAsyncProgress so the UI can get notification of the properties + /// being changed. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public interface IAsyncProgress + { + /// + /// Gets a value indicating whether the async operation is currently running. + /// + bool OperationInProgress + { + get; + } + + /// + /// Gets a the error for the async operation. This field is only valid if + /// OperationInProgress is false. null indicates there was no error. + /// + Exception OperationError + { + get; + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IStateDescriptorFactory.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IStateDescriptorFactory.cs new file mode 100644 index 00000000000..ce365a89799 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IStateDescriptorFactory.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Diagnostics.CodeAnalysis; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Defines an interface for a factory that creates + /// StateDescriptors. + /// + /// The type T used by the StateDescriptor. + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public interface IStateDescriptorFactory + { + /// + /// Creates a new StateDescriptor based upon custom + /// logic. + /// + /// A new StateDescriptor. + StateDescriptor Create(); + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IntegralConverter.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IntegralConverter.cs new file mode 100644 index 00000000000..1aa783316e7 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IntegralConverter.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Data; +using System.Diagnostics.CodeAnalysis; +using System.Windows; +using System.Globalization; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Takes a value and returns the largest value which is a integral amount of the second value. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public class IntegralConverter : IMultiValueConverter + { + /// + /// Takes a value and returns the largest value which is a integral amount of the second value. + /// + /// + /// The first value is the source. The second is the factor. + /// + /// The parameter is not used. + /// The padding to subtract from the first value. + /// The parameter is not used. + /// + /// The integral value. + /// + public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (values == null) + { + throw new ArgumentNullException("values"); + } + + if (2 != values.Length) + { + throw new ArgumentException("Two values expected", "values"); + } + + if (values[0] == DependencyProperty.UnsetValue || + values[1] == DependencyProperty.UnsetValue) + { + return DependencyProperty.UnsetValue; + } + + var source = (double) values[0]; + var factor = (double)values[1]; + + double padding = 0; + + if (parameter != null) + { + padding = Double.Parse((string)parameter, CultureInfo.InvariantCulture); + } + + var newSource = source - padding; + + if (newSource < factor) + { + return source; + } + + var remainder = newSource % factor; + var result = newSource - remainder; + + return result; + + } + + /// + /// This method is not used. + /// + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/InverseBooleanConverter.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/InverseBooleanConverter.cs new file mode 100644 index 00000000000..769af827f0e --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/InverseBooleanConverter.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Windows.Data; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Takes a bool value and returns the inverse. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public class InverseBooleanConverter : IValueConverter + { + /// + /// Converts a boolean value to be it's inverse. + /// + /// The source value. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// The inverted boolean value. + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (value == null) + { + throw new ArgumentNullException("value"); + } + + var boolValue = (bool)value; + + return !boolValue; + } + + /// + /// This method is not used. + /// + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IsEqualConverter.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IsEqualConverter.cs new file mode 100644 index 00000000000..5801220d912 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IsEqualConverter.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Data; +using System.Diagnostics.CodeAnalysis; +using System.Windows; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// Takes two objects and determines whether they are equal. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public class IsEqualConverter : IMultiValueConverter + { + /// + /// Takes two items and determines whether they are equal. + /// + /// + /// Two objects of any type. + /// + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// + /// True if-and-only-if the two objects are equal per Object.Equals(). + /// Null is equal only to null. + /// + public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + if (values == null) + { + throw new ArgumentNullException("values"); + } + + if (2 != values.Length) + { + throw new ArgumentException("Two values expected", "values"); + } + + object item1 = values[0]; + object item2 = values[1]; + + if (null == item1) + { + return (null == item2); + } + + if (null == item2) + { + return false; + } + + bool equal = item1.Equals(item2); + return equal; + } + + /// + /// This method is not used. + /// + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IsNotNullConverter.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IsNotNullConverter.cs new file mode 100644 index 00000000000..dccec8ff406 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/IsNotNullConverter.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Windows.Data; + +namespace Microsoft.Management.UI.Internal +{ + + /// + /// The IsNotNullConverter is responsible for converting a value into + /// a boolean indicting whether the value is not null. + /// + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] + public class IsNotNullConverter : IValueConverter + { + #region IValueConverter Members + + /// + /// Determines if value is not null. + /// + /// The object to check. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// Returns true if value is not null, false otherwise. + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return (null != value); + } + + /// + /// This method is not used. + /// + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + /// The parameter is not used. + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } + + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/KeyboardHelp.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/KeyboardHelp.cs new file mode 100644 index 00000000000..0e943731a6f --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/KeyboardHelp.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows.Input; +using System.Diagnostics; +using System.Windows; + +namespace Microsoft.Management.UI.Internal +{ + internal enum LogicalDirection + { + None, + Left, + Right + } + + internal static class KeyboardHelp + { + /// + /// Gets the logical direction for a key, taking into account RTL settings. + /// + /// The element to get FlowDirection from. + /// The key pressed. + /// The logical direction. + public static LogicalDirection GetLogicalDirection(DependencyObject element, Key key) + { + Debug.Assert(element != null); + + bool rightToLeft = IsElementRightToLeft(element); + + switch (key) + { + case Key.Right: + if (rightToLeft) + { + return LogicalDirection.Left; + } + else + { + return LogicalDirection.Right; + } + + case Key.Left: + if (rightToLeft) + { + return LogicalDirection.Right; + } + else + { + return LogicalDirection.Left; + } + + default: + return LogicalDirection.None; + } + } + + /// + /// Gets the focus direction for a key, taking into account RTL settings. + /// + /// The element to get FlowDirection from. + /// The key pressed. + /// The focus direction. + public static FocusNavigationDirection GetNavigationDirection(DependencyObject element, Key key) + { + Debug.Assert(element != null); + Debug.Assert(IsFlowDirectionKey(key)); + + bool rightToLeft = IsElementRightToLeft(element); + + switch (key) + { + case Key.Right: + if (rightToLeft) + { + return FocusNavigationDirection.Left; + } + else + { + return FocusNavigationDirection.Right; + } + + case Key.Left: + if (rightToLeft) + { + return FocusNavigationDirection.Right; + } + else + { + return FocusNavigationDirection.Left; + } + + case Key.Down: + return FocusNavigationDirection.Down; + case Key.Up: + return FocusNavigationDirection.Up; + default: + Debug.Fail("Non-direction key specified"); + return FocusNavigationDirection.First; + } + } + + /// + /// Determines if the control key is pressed. + /// + /// True if a control is is pressed. + public static bool IsControlPressed() + { + if (ModifierKeys.Control == (Keyboard.Modifiers & ModifierKeys.Control)) + { + return true; + } + else + { + return false; + } + } + + /// + /// Determines if the key is a navigation key. + /// + /// The key pressed. + /// True if the key is a navigation key. + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + private static bool IsFlowDirectionKey(Key key) + { + switch (key) + { + case Key.Right: + case Key.Left: + case Key.Down: + case Key.Up: + return true; + default: + return false; + } + } + + private static bool IsElementRightToLeft(DependencyObject element) + { + FlowDirection flowDirection = FrameworkElement.GetFlowDirection(element); + bool rightToLeft = (flowDirection == FlowDirection.RightToLeft); + return rightToLeft; + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ListOrganizer.Generated.cs b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ListOrganizer.Generated.cs new file mode 100644 index 00000000000..14f11d91c2f --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ManagementList/Common/ListOrganizer.Generated.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// +// +// This code was generated by a tool. DO NOT EDIT +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// + +#region StyleCop Suppression - generated code +using System; +using System.Collections; +using System.ComponentModel; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; + +namespace Microsoft.Management.UI.Internal +{ + + /// + /// This control presents a dropdown listbox with associated organizing actions that can be performed on it. + /// + /// + /// + /// + /// If a custom template is provided for this control, then the template MUST provide the following template parts: + /// + /// PART_Picker - A required template part which must be of type PickerBase. This control provides basic functionality for Picker-like controls. + /// + /// + [TemplatePart(Name="PART_Picker", Type=typeof(PickerBase))] + [Localizability(LocalizationCategory.None)] + partial class ListOrganizer + { + // + // Fields + // + private PickerBase picker; + + // + // ItemDeleted RoutedEvent + // + /// + /// Identifies the ItemDeleted RoutedEvent. + /// + public static readonly RoutedEvent ItemDeletedEvent = EventManager.RegisterRoutedEvent("ItemDeleted",RoutingStrategy.Bubble,typeof(EventHandler>),typeof(ListOrganizer)); + + /// + /// Occurs when an item is deleted from the list. + /// + public event EventHandler> ItemDeleted + { + add + { + AddHandler(ItemDeletedEvent,value); + } + remove + { + RemoveHandler(ItemDeletedEvent,value); + } + } + + // + // ItemSelected RoutedEvent + // + /// + /// Identifies the ItemSelected RoutedEvent. + /// + public static readonly RoutedEvent ItemSelectedEvent = EventManager.RegisterRoutedEvent("ItemSelected",RoutingStrategy.Bubble,typeof(EventHandler>),typeof(ListOrganizer)); + + /// + /// Occurs when an item is selected in the list. + /// + public event EventHandler> ItemSelected + { + add + { + AddHandler(ItemSelectedEvent,value); + } + remove + { + RemoveHandler(ItemSelectedEvent,value); + } + } + + // + // DeleteItem routed command + // + /// + /// Informs the ListOrganizer that it should delete the item passed. + /// + public static readonly RoutedCommand DeleteItemCommand = new RoutedCommand("DeleteItem",typeof(ListOrganizer)); + + static private void DeleteItemCommand_CommandExecuted(object sender, ExecutedRoutedEventArgs e) + { + ListOrganizer obj = (ListOrganizer) sender; + obj.OnDeleteItemExecuted( e ); + } + + /// + /// Called when DeleteItem executes. + /// + /// + /// Informs the ListOrganizer that it should delete the item passed. + /// + protected virtual void OnDeleteItemExecuted(ExecutedRoutedEventArgs e) + { + OnDeleteItemExecutedImplementation(e); + } + + partial void OnDeleteItemExecutedImplementation(ExecutedRoutedEventArgs e); + + // + // SelectItem routed command + // + /// + /// Informs the ListOrganizer that it should select the item passed. + /// + public static readonly RoutedCommand SelectItemCommand = new RoutedCommand("SelectItem",typeof(ListOrganizer)); + + static private void SelectItemCommand_CommandExecuted(object sender, ExecutedRoutedEventArgs e) + { + ListOrganizer obj = (ListOrganizer) sender; + obj.OnSelectItemExecuted( e ); + } + + /// + /// Called when SelectItem executes. + /// + /// + /// Informs the ListOrganizer that it should select the item passed. + /// + protected virtual void OnSelectItemExecuted(ExecutedRoutedEventArgs e) + { + OnSelectItemExecutedImplementation(e); + } + + partial void OnSelectItemExecutedImplementation(ExecutedRoutedEventArgs e); + + // + // DropDownButtonTemplate dependency property + // + /// + /// Identifies the DropDownButtonTemplate dependency property. + /// + public static readonly DependencyProperty DropDownButtonTemplateProperty = DependencyProperty.Register( "DropDownButtonTemplate", typeof(ControlTemplate), typeof(ListOrganizer), new PropertyMetadata( null, DropDownButtonTemplateProperty_PropertyChanged) ); + + /// + /// Gets or sets a value that controls the visual tree of the DropDown button. + /// + [Bindable(true)] + [Category("Common Properties")] + [Description("Gets or sets a value that controls the visual tree of the DropDown button.")] + [Localizability(LocalizationCategory.None)] + public ControlTemplate DropDownButtonTemplate + { + get + { + return (ControlTemplate) GetValue(DropDownButtonTemplateProperty); + } + set + { + SetValue(DropDownButtonTemplateProperty,value); + } + } + + static private void DropDownButtonTemplateProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + ListOrganizer obj = (ListOrganizer) o; + obj.OnDropDownButtonTemplateChanged( new PropertyChangedEventArgs((ControlTemplate)e.OldValue, (ControlTemplate)e.NewValue) ); + } + + /// + /// Occurs when DropDownButtonTemplate property changes. + /// + public event EventHandler> DropDownButtonTemplateChanged; + + /// + /// Called when DropDownButtonTemplate property changes. + /// + protected virtual void OnDropDownButtonTemplateChanged(PropertyChangedEventArgs e) + { + OnDropDownButtonTemplateChangedImplementation(e); + RaisePropertyChangedEvent(DropDownButtonTemplateChanged, e); + } + + partial void OnDropDownButtonTemplateChangedImplementation(PropertyChangedEventArgs e); + + // + // DropDownStyle dependency property + // + /// + /// Identifies the DropDownStyle dependency property. + /// + public static readonly DependencyProperty DropDownStyleProperty = DependencyProperty.Register( "DropDownStyle", typeof(Style), typeof(ListOrganizer), new PropertyMetadata( null, DropDownStyleProperty_PropertyChanged) ); + + /// + /// Gets or sets the style of the drop-down. + /// + [Bindable(true)] + [Category("Common Properties")] + [Description("Gets or sets the style of the drop-down.")] + [Localizability(LocalizationCategory.None)] + public Style DropDownStyle + { + get + { + return (Style) GetValue(DropDownStyleProperty); + } + set + { + SetValue(DropDownStyleProperty,value); + } + } + + static private void DropDownStyleProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) + { + ListOrganizer obj = (ListOrganizer) o; + obj.OnDropDownStyleChanged( new PropertyChangedEventArgs + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/AllModulesControl.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/AllModulesControl.xaml.cs new file mode 100644 index 00000000000..c6d35b3d689 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/AllModulesControl.xaml.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.ComponentModel; +using System.Windows; +using System.Windows.Controls; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Interaction logic for AllModulesControl.xaml + /// + public partial class AllModulesControl : UserControl + { + #region Construction and Destructor + + /// + /// Initializes a new instance of the AllModulesControl class + /// + public AllModulesControl() + { + InitializeComponent(); + + this.Loaded += (obj, args) => { + this.ModulesCombo.Focus(); + }; + } + + #endregion + /// + /// Gets current control of the ShowModuleControl + /// + internal ShowModuleControl CurrentShowModuleControl + { + get { return this.ShowModuleControl; } + } + + private void RefreshButton_Click(object sender, System.Windows.RoutedEventArgs e) + { + AllModulesViewModel viewModel = this.DataContext as AllModulesViewModel; + if (viewModel == null) + { + return; + } + + viewModel.OnRefresh(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/CmdletControl.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/CmdletControl.xaml new file mode 100644 index 00000000000..42e908aefa3 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/CmdletControl.xaml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/CmdletControl.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/CmdletControl.xaml.cs new file mode 100644 index 00000000000..c69f020904b --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/CmdletControl.xaml.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Windows; +using System.Windows.Controls; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Interaction logic for CmdletControl.xaml + /// + public partial class CmdletControl : UserControl + { + /// + /// Field used for the CurrentCommandViewModel parameter. + /// + private CommandViewModel currentCommandViewModel; + + #region Construction and Destructor + /// + /// Initializes a new instance of the CmdletControl class + /// + public CmdletControl() + { + InitializeComponent(); + this.NotImportedControl.ImportModuleButton.Click += new RoutedEventHandler(ImportModuleButton_Click); + this.ParameterSetTabControl.DataContextChanged += new DependencyPropertyChangedEventHandler(this.ParameterSetTabControl_DataContextChanged); + this.KeyDown += new System.Windows.Input.KeyEventHandler(this.CmdletControl_KeyDown); + this.helpButton.innerButton.Click += new RoutedEventHandler(this.HelpButton_Click); + } + #endregion + + #region Properties + /// + /// Gets the owner of the ViewModel. + /// + private CommandViewModel CurrentCommandViewModel + { + get { return this.currentCommandViewModel; } + } + #endregion + + #region Private Events + + /// + /// DataContextChanged event. + /// + /// Event sender + /// Event args + private void ParameterSetTabControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + if (this.DataContext == null) + { + return; + } + + CommandViewModel viewModel = (CommandViewModel)this.DataContext; + this.currentCommandViewModel = viewModel; + + if (viewModel.ParameterSets.Count == 0) + { + return; + } + + this.ParameterSetTabControl.SelectedItem = viewModel.ParameterSets[0]; + } + + /// + /// Key down event for user press F1 button. + /// + /// Event sender + /// Event args + private void CmdletControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) + { + if (e.Key == System.Windows.Input.Key.F1) + { + this.CurrentCommandViewModel.OpenHelpWindow(); + } + } + + /// + /// Help button event. + /// + /// Event sender + /// Event args + private void HelpButton_Click(object sender, RoutedEventArgs e) + { + this.CurrentCommandViewModel.OpenHelpWindow(); + } + + /// + /// Import Module Button event + /// + /// Event sender + /// Event args + private void ImportModuleButton_Click(object sender, RoutedEventArgs e) + { + this.CurrentCommandViewModel.OnImportModule(); + } + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml new file mode 100644 index 00000000000..c78c592fc6a --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs new file mode 100644 index 00000000000..241ef0b4020 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Diagnostics.CodeAnalysis; +using System.Windows.Automation; +using System.Windows.Automation.Peers; +using System.Windows.Controls; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Button with images to represent enabled and disabled states + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes", Justification = "Required by XAML")] + public partial class ImageButton : ImageButtonBase + { + /// + /// Initializes a new instance of the ImageButton class. + /// + public ImageButton() + { + InitializeComponent(); + this.Loaded += new System.Windows.RoutedEventHandler(this.ImageButton_Loaded); + } + + /// + /// Copies the automation id and name from the parent control to the inner button + /// + /// event sender + /// event arguments + private void ImageButton_Loaded(object sender, System.Windows.RoutedEventArgs e) + { + object thisAutomationId = this.GetValue(AutomationProperties.AutomationIdProperty); + if (thisAutomationId != null) + { + this.innerButton.SetValue(AutomationProperties.AutomationIdProperty, thisAutomationId); + } + + object thisAutomationName = this.GetValue(AutomationProperties.NameProperty); + if (thisAutomationName != null) + { + this.innerButton.SetValue(AutomationProperties.NameProperty, thisAutomationName); + } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonBase.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonBase.cs new file mode 100644 index 00000000000..8369160bff0 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonBase.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Implements the ImageButtonBase base class to the ImageButton and ImageToggleButton. + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes", Justification = "Required by XAML")] + public class ImageButtonBase : Grid + { + /// + /// Command associated with this button + /// + public static readonly DependencyProperty CommandProperty = + DependencyProperty.Register("Command", typeof(RoutedUICommand), typeof(ImageButton)); + + /// + /// Image to be used for the enabled state + /// + public static readonly DependencyProperty EnabledImageSourceProperty = + DependencyProperty.Register("EnabledImageSource", typeof(ImageSource), typeof(ImageButton)); + + /// + /// Image to be used for the disabled state + /// + public static readonly DependencyProperty DisabledImageSourceProperty = + DependencyProperty.Register("DisabledImageSource", typeof(ImageSource), typeof(ImageButton)); + + /// + /// Gets or sets the image to be used for the enabled state + /// + public ImageSource EnabledImageSource + { + get { return (ImageSource)GetValue(ImageButton.EnabledImageSourceProperty); } + set { SetValue(ImageButton.EnabledImageSourceProperty, value); } + } + + /// + /// Gets or sets the image to be used for the disabled state + /// + public ImageSource DisabledImageSource + { + get { return (ImageSource)GetValue(ImageButton.DisabledImageSourceProperty); } + set { SetValue(ImageButton.DisabledImageSourceProperty, value); } + } + + /// + /// Gets or sets the command associated with this button + /// + public RoutedUICommand Command + { + get { return (RoutedUICommand)GetValue(ImageButton.CommandProperty); } + set { SetValue(ImageButton.CommandProperty, value); } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml new file mode 100644 index 00000000000..1c3a35abdde --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs new file mode 100644 index 00000000000..37b4848dec4 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Windows.Controls; +using System.Windows.Data; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Converts a an ImageButtonBase to its corresponding ToolTip + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes", Justification = "Needed for XAML")] + public class ImageButtonToolTipConverter : IValueConverter + { + // This class is meant to be used like this in XAML: + // + // ... + // + // + // + // ... + // + #region IValueConverter Members + + /// + /// Converts a an ImageButtonBase to its corresponding ToolTip by checking if it has a tooltip property + /// or a command with tooltip text + /// + /// The ImageButtonBase we are trying to Convert. + /// is not used. + /// is not used. + /// is not used. + /// The resulting object obtained from retrieving the property value in (or property values if contains dots) out of . + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + ImageButtonBase imageButtonBase = value as ImageButtonBase; + if (imageButtonBase == null) + { + return null; + } + + object toolTipObj = imageButtonBase.GetValue(Button.ToolTipProperty); + if (toolTipObj != null) + { + return toolTipObj.ToString(); + } + + if (imageButtonBase.Command != null && !String.IsNullOrEmpty(imageButtonBase.Command.Text)) + { + return imageButtonBase.Command.Text.Replace("_", String.Empty); + } + + return null; + } + + /// + /// This method is not supported. + /// + /// is not used. + /// is not used. + /// is not used. + /// is not used. + /// No value is returned. + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + throw new NotSupportedException(); + } + + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml new file mode 100644 index 00000000000..5d8a7e8dbd0 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs new file mode 100644 index 00000000000..77c6272cefd --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Diagnostics.CodeAnalysis; +using System.Windows; +using System.Windows.Automation; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Toggle button with images to represent enabled and disabled states + /// + [SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes", Justification = "Required by XAML")] + public partial class ImageToggleButton : ImageButtonBase + { + /// + /// Value indicating the button is checked + /// + public static readonly DependencyProperty IsCheckedProperty = + DependencyProperty.Register("IsChecked", typeof(bool), typeof(ImageToggleButton)); + + /// + /// Initializes a new instance of the ImageToggleButton class. + /// + public ImageToggleButton() + { + InitializeComponent(); + this.Loaded += new System.Windows.RoutedEventHandler(this.ImageButton_Loaded); + } + + /// + /// Gets or sets a value indicating whether the button is checked + /// + public bool IsChecked + { + get { return (bool)GetValue(ImageToggleButton.IsCheckedProperty); } + set { SetValue(ImageToggleButton.IsCheckedProperty, value); } + } + + /// + /// Copies the automation id and name from the parent control to the inner button + /// + /// event sender + /// event arguments + private void ImageButton_Loaded(object sender, System.Windows.RoutedEventArgs e) + { + object thisAutomationId = this.GetValue(AutomationProperties.AutomationIdProperty); + if (thisAutomationId != null) + { + this.toggleInnerButton.SetValue(AutomationProperties.AutomationIdProperty, thisAutomationId); + } + + object thisAutomationName = this.GetValue(AutomationProperties.NameProperty); + if (thisAutomationName != null) + { + this.toggleInnerButton.SetValue(AutomationProperties.NameProperty, thisAutomationName); + } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml new file mode 100644 index 00000000000..a55eaa85766 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml.cs new file mode 100644 index 00000000000..0ee8fcbacd1 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Globalization; +using System.Management.Automation; +using System.Text; +using System.Windows; +using System.Windows.Controls; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Interaction logic for MultipleSelectionControl.xaml + /// + public partial class MultipleSelectionControl : UserControl + { + /// + /// Initializes a new instance of the MultipleSelectionControl class + /// + public MultipleSelectionControl() + { + InitializeComponent(); + } + + /// + /// Show more items in new dialog + /// + /// event sender + /// event arguments + private void ButtonBrowse_Click(object sender, RoutedEventArgs e) + { + MultipleSelectionDialog multipleSelectionDialog = new MultipleSelectionDialog(); + multipleSelectionDialog.Title = this.multipleValueButton.ToolTip.ToString(); + multipleSelectionDialog.listboxParameter.ItemsSource = comboxParameter.ItemsSource; + multipleSelectionDialog.ShowDialog(); + + if (multipleSelectionDialog.DialogResult != true) + { + return; + } + + StringBuilder newComboText = new StringBuilder(); + + foreach (object selectedItem in multipleSelectionDialog.listboxParameter.SelectedItems) + { + newComboText.AppendFormat(CultureInfo.InvariantCulture, "{0},", selectedItem.ToString()); + } + + if (newComboText.Length > 1) + { + newComboText.Remove(newComboText.Length - 1, 1); + } + + comboxParameter.Text = newComboText.ToString(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/NotImportedCmdletControl.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/NotImportedCmdletControl.xaml new file mode 100644 index 00000000000..59e51ca2b06 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/NotImportedCmdletControl.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/NotImportedCmdletControl.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/NotImportedCmdletControl.xaml.cs new file mode 100644 index 00000000000..70e7752b5d4 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/NotImportedCmdletControl.xaml.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Windows.Controls; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Interaction logic for NotImportedCmdletControl.xaml + /// + public partial class NotImportedCmdletControl : UserControl + { + #region Construction and Destructor + + /// + /// Initializes a new instance of the NotImportedCmdletControl class + /// + public NotImportedCmdletControl() + { + InitializeComponent(); + } + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml new file mode 100644 index 00000000000..a1f714e4588 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml @@ -0,0 +1,17 @@ + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml.cs new file mode 100644 index 00000000000..2c14d5ae031 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Management.Automation; +using System.Windows; +using System.Windows.Automation; +using System.Windows.Controls; +using System.Windows.Data; + +using Microsoft.Management.UI.Internal; +using Microsoft.PowerShell.Commands.ShowCommandExtension; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Interaction logic for ParameterSetControl.xaml + /// + public partial class ParameterSetControl : UserControl + { + /// + /// First focusable element in the generated UI. + /// + UIElement firstFocusableElement; + + /// + /// Field used for the CurrentParameterSetViewModel parameter. + /// + private ParameterSetViewModel currentParameterSetViewModel; + + #region Construction and Destructor + /// + /// Initializes a new instance of the ParameterSetControl class + /// + public ParameterSetControl() + { + InitializeComponent(); + this.DataContextChanged += new DependencyPropertyChangedEventHandler(this.ParameterSetControl_DataContextChanged); + } + #endregion + + #region Public Methods + + /// + /// Focuses the first focusable element in this control. + /// + public void FocusFirstElement() + { + if (this.firstFocusableElement != null) + { + this.firstFocusableElement.Focus(); + } + } + + #endregion + + #region Private Property + /// + /// Gets current ParameterSetViewModel. + /// + private ParameterSetViewModel CurrentParameterSetViewModel + { + get { return this.currentParameterSetViewModel; } + } + + #endregion + + /// + /// Creates a CheckBox for switch parameters + /// + /// DataContext object + /// Row number + /// a CheckBox for switch parameters + private static CheckBox CreateCheckBox(ParameterViewModel parameterViewModel, int rowNumber) + { + CheckBox checkBox = new CheckBox(); + + checkBox.SetBinding(Label.ContentProperty, new Binding("NameCheckLabel")); + checkBox.DataContext = parameterViewModel; + checkBox.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; + checkBox.SetValue(Grid.ColumnProperty, 0); + checkBox.SetValue(Grid.ColumnSpanProperty, 2); + checkBox.SetValue(Grid.RowProperty, rowNumber); + checkBox.IsThreeState = false; + checkBox.Margin = new Thickness(8, rowNumber == 0 ? 7 : 5, 0, 5); + checkBox.SetBinding(CheckBox.ToolTipProperty, new Binding("ToolTip")); + checkBox.SetBinding(AutomationProperties.HelpTextProperty, new Binding("ToolTip")); + Binding valueBinding = new Binding("Value"); + checkBox.SetBinding(CheckBox.IsCheckedProperty, valueBinding); + + //// Add AutomationProperties.AutomationId for Ui Automation test. + checkBox.SetValue( + System.Windows.Automation.AutomationProperties.AutomationIdProperty, + string.Format(CultureInfo.CurrentCulture, "chk{0}", parameterViewModel.Name)); + + checkBox.SetValue( + System.Windows.Automation.AutomationProperties.NameProperty, + parameterViewModel.Name); + + return checkBox; + } + + /// + /// Creates a ComboBox control for input type field + /// + /// DataContext object + /// Row number + /// Control data source + /// Return a ComboBox control + private static ComboBox CreateComboBoxControl(ParameterViewModel parameterViewModel, int rowNumber, IEnumerable itemsSource) + { + ComboBox comboBox = new ComboBox(); + + comboBox.DataContext = parameterViewModel; + comboBox.SetValue(Grid.ColumnProperty, 1); + comboBox.SetValue(Grid.RowProperty, rowNumber); + comboBox.Margin = new Thickness(2); + comboBox.SetBinding(TextBox.ToolTipProperty, new Binding("ToolTip")); + comboBox.ItemsSource = itemsSource; + + Binding selectedItemBinding = new Binding("Value"); + comboBox.SetBinding(ComboBox.SelectedItemProperty, selectedItemBinding); + + string automationId = string.Format( + CultureInfo.CurrentCulture, + "combox{0}", + parameterViewModel.Name); + + //// Add AutomationProperties.AutomationId for Ui Automation test. + comboBox.SetValue( + System.Windows.Automation.AutomationProperties.AutomationIdProperty, + automationId); + + comboBox.SetValue( + System.Windows.Automation.AutomationProperties.NameProperty, + parameterViewModel.Name); + + return comboBox; + } + + /// + /// Creates a MultiSelectCombo control for input type field + /// + /// DataContext object + /// Row number + /// Control data source + /// Return a MultiSelectCombo control + private static MultipleSelectionControl CreateMultiSelectComboControl(ParameterViewModel parameterViewModel, int rowNumber, IEnumerable itemsSource) + { + MultipleSelectionControl multiControls = new MultipleSelectionControl(); + + multiControls.DataContext = parameterViewModel; + multiControls.SetValue(Grid.ColumnProperty, 1); + multiControls.SetValue(Grid.RowProperty, rowNumber); + multiControls.Margin = new Thickness(2); + multiControls.comboxParameter.ItemsSource = itemsSource; + multiControls.SetBinding(TextBox.ToolTipProperty, new Binding("ToolTip")); + + Binding valueBinding = new Binding("Value"); + valueBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; + multiControls.comboxParameter.SetBinding(ComboBox.TextProperty, valueBinding); + + // Add AutomationProperties.AutomationId for Ui Automation test. + multiControls.SetValue(System.Windows.Automation.AutomationProperties.AutomationIdProperty, string.Format("combox{0}", parameterViewModel.Name)); + + multiControls.comboxParameter.SetValue( + System.Windows.Automation.AutomationProperties.NameProperty, + parameterViewModel.Name); + + string buttonToolTipAndName = String.Format( + CultureInfo.CurrentUICulture, + ShowCommandResources.SelectMultipleValuesForParameterFormat, + parameterViewModel.Name); + + multiControls.multipleValueButton.SetValue(Button.ToolTipProperty, buttonToolTipAndName); + multiControls.multipleValueButton.SetValue( + System.Windows.Automation.AutomationProperties.NameProperty, + buttonToolTipAndName); + + return multiControls; + } + + /// + /// Creates a TextBox control for input type field + /// + /// DataContext object + /// Row number + /// Return a TextBox control + private static TextBox CreateTextBoxControl(ParameterViewModel parameterViewModel, int rowNumber) + { + TextBox textBox = new TextBox(); + + textBox.DataContext = parameterViewModel; + textBox.SetValue(Grid.ColumnProperty, 1); + textBox.SetValue(Grid.RowProperty, rowNumber); + textBox.Margin = new Thickness(2); + textBox.SetBinding(TextBox.ToolTipProperty, new Binding("ToolTip")); + + Binding valueBinding = new Binding("Value"); + valueBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; + textBox.SetBinding(TextBox.TextProperty, valueBinding); + + //// Add AutomationProperties.AutomationId for UI Automation test. + textBox.SetValue( + System.Windows.Automation.AutomationProperties.AutomationIdProperty, + string.Format(CultureInfo.CurrentCulture, "txt{0}", parameterViewModel.Name)); + + textBox.SetValue( + System.Windows.Automation.AutomationProperties.NameProperty, + parameterViewModel.Name); + + ShowCommandParameterType parameterType = parameterViewModel.Parameter.ParameterType; + + if (parameterType.IsArray) + { + parameterType = parameterType.ElementType; + } + + if (parameterType.IsScriptBlock || parameterType.ImplementsDictionary) + { + textBox.AcceptsReturn = true; + textBox.VerticalScrollBarVisibility = ScrollBarVisibility.Auto; + textBox.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; + textBox.Loaded += new RoutedEventHandler(ParameterSetControl.MultiLineTextBox_Loaded); + } + + return textBox; + } + + /// + /// Called for a newly created multiline text box to increase its height and + /// + /// event sender + /// event arguments + private static void MultiLineTextBox_Loaded(object sender, RoutedEventArgs e) + { + TextBox senderTextBox = (TextBox)sender; + senderTextBox.Loaded -= new RoutedEventHandler(ParameterSetControl.MultiLineTextBox_Loaded); + + // This will set the height to about 3 lines since the total height of the + // TextBox is a bit greater than a line's height + senderTextBox.Height = senderTextBox.ActualHeight * 2; + } + + #region Event Methods + + /// + /// When user switch ParameterSet.It will trigger this event. + /// This event method will renew generate all controls for current ParameterSet. + /// + /// Event sender + /// Event args + private void ParameterSetControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + this.firstFocusableElement = null; + this.MainGrid.Children.Clear(); + this.MainGrid.RowDefinitions.Clear(); + + ParameterSetViewModel viewModel = e.NewValue as ParameterSetViewModel; + if (viewModel == null) + { + return; + } + + this.currentParameterSetViewModel = viewModel; + + for (int rowNumber = 0; rowNumber < viewModel.Parameters.Count; rowNumber++) + { + ParameterViewModel parameter = viewModel.Parameters[rowNumber]; + this.MainGrid.RowDefinitions.Add(this.CreateNewRow()); + + if (parameter.Parameter.ParameterType.IsSwitch) + { + this.AddControlToMainGrid(ParameterSetControl.CreateCheckBox(parameter, rowNumber)); + } + else + { + this.CreateAndAddLabel(parameter, rowNumber); + Control control = null; + if(parameter.Parameter.HasParameterSet) + { + // For ValidateSet parameter + ArrayList itemsSource = new ArrayList(); + itemsSource.Add(String.Empty); + + for (int i = 0; i < parameter.Parameter.ValidParamSetValues.Count; i++) + { + itemsSource.Add(parameter.Parameter.ValidParamSetValues[i]); + } + + control = ParameterSetControl.CreateComboBoxControl(parameter, rowNumber, itemsSource); + } + else if (parameter.Parameter.ParameterType.IsEnum) + { + if (parameter.Parameter.ParameterType.HasFlagAttribute) + { + ArrayList itemsSource = new ArrayList(); + itemsSource.Add(String.Empty); + itemsSource.AddRange(parameter.Parameter.ParameterType.EnumValues); + control = ParameterSetControl.CreateComboBoxControl(parameter, rowNumber, itemsSource); + } + else + { + control = ParameterSetControl.CreateMultiSelectComboControl(parameter, rowNumber, parameter.Parameter.ParameterType.EnumValues); + } + } + else if (parameter.Parameter.ParameterType.IsBoolean) + { + control = ParameterSetControl.CreateComboBoxControl(parameter, rowNumber, new string[] { String.Empty, "$True", "$False" }); + } + else + { + // For input parameter + control = ParameterSetControl.CreateTextBoxControl(parameter, rowNumber); + } + + if (control != null) + { + this.AddControlToMainGrid(control); + } + } + } + } + + /// + /// When user trigger click on anyone CheckBox. Get value from sender. + /// + /// Event sender + /// Event args + private void CheckBox_Click(object sender, RoutedEventArgs e) + { + CheckBox senderCheck = (CheckBox)sender; + ((ParameterViewModel)senderCheck.DataContext).Value = senderCheck.IsChecked.ToString(); + } + + #endregion + + #region Private Method + + /// + /// Creates a RowDefinition for MainGrid + /// + /// Return a RowDefinition object + private RowDefinition CreateNewRow() + { + RowDefinition row = new RowDefinition(); + row.Height = GridLength.Auto; + return row; + } + + /// + /// Adds a control to MainGrid; + /// + /// Will adding UIControl + private void AddControlToMainGrid(UIElement uiControl) + { + if (this.firstFocusableElement == null && !(uiControl is Label)) + { + this.firstFocusableElement = uiControl; + } + + this.MainGrid.Children.Add(uiControl); + } + + /// + /// Creates a Lable control and add it to MainGrid + /// + /// DataContext object + /// Row number + private void CreateAndAddLabel(ParameterViewModel parameterViewModel, int rowNumber) + { + Label label = this.CreateLabel(parameterViewModel, rowNumber); + this.AddControlToMainGrid(label); + } + + /// + /// Creates a Label control for input type field + /// + /// DataContext object + /// Row number + /// Return a Label control + private Label CreateLabel(ParameterViewModel parameterViewModel, int rowNumber) + { + Label label = new Label(); + + label.SetBinding(Label.ContentProperty, new Binding("NameTextLabel")); + label.DataContext = parameterViewModel; + label.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; + label.SetValue(Grid.ColumnProperty, 0); + label.SetValue(Grid.RowProperty, rowNumber); + label.Margin = new Thickness(2); + label.SetBinding(Label.ToolTipProperty, new Binding("ToolTip")); + + //// Add AutomationProperties.AutomationId for Ui Automation test. + label.SetValue( + System.Windows.Automation.AutomationProperties.AutomationIdProperty, + string.Format(CultureInfo.CurrentCulture, "lbl{0}", parameterViewModel.Name)); + + return label; + } + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml new file mode 100644 index 00000000000..b622c1a5d27 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml.cs new file mode 100644 index 00000000000..8cb7c2eb611 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Management.Automation; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Control taht shows cmdlets in a module and details for a selected cmdlet + /// + public partial class ShowModuleControl : UserControl + { + /// + /// Field used for the Owner parameter. + /// + private Window owner; + + /// + /// Initializes a new instance of the ShowModuleControl class + /// + public ShowModuleControl() + { + InitializeComponent(); + + // See comment in method summary to understand why this event is handled + this.CommandList.PreviewMouseMove += new MouseEventHandler(this.CommandList_PreviewMouseMove); + + // See comment in method summary to understand why this event is handled + this.CommandList.SelectionChanged += new SelectionChangedEventHandler(this.CommandList_SelectionChanged); + } + + /// + /// Gets or sets the owner of the container. + /// + public Window Owner + { + get { return this.owner; } + set { this.owner = value; } + } + + #region Events Handlers + /// + /// WPF has an interesting feature in list selection where if you hold the mouse button down, + /// it will select the item under it, but if you keep the mouse button down and move the mouse + /// (if the list supported drag and drop, the mouse action would be the same as dragging) it + /// will select other list items. + /// If the first selection change causes details for the item to be displayed and resizes the list + /// the selection can skip to another list item it happend to be over as the list got resized. + /// In summary, resizing the list on selection can cause a selection bug. If the user selects an + /// item in the end of the list the next item downwards can be selected. + /// The WPF drag-and-select feature is not a standard win32 list behavior, and we can do without it + /// since it causes this problem. + /// WPF sets up this behavior by using a mouse capture. We undo the behavior in the handler below + /// which removes the behavior. + /// + /// event sender + /// event arguments + private void CommandList_PreviewMouseMove(object sender, MouseEventArgs e) + { + if (this.CommandList.IsMouseCaptured) + { + this.CommandList.ReleaseMouseCapture(); + } + } + + /// + /// Ensures the selected item is scrolled into view and that the list is focused. + /// An item could be out of the view if the selection was changed in the object model + /// + /// event sender + /// event arguments + private void CommandList_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (this.CommandList.SelectedItem == null) + { + return; + } + + this.CommandList.ScrollIntoView(this.CommandList.SelectedItem); + } + #endregion Events Handlers + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.Designer.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.Designer.cs new file mode 100644 index 00000000000..d05a4d8ff35 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.Designer.cs @@ -0,0 +1,146 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.16808 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Management.UI.Internal.ShowCommand { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class ShowCommandSettings : global::System.Configuration.ApplicationSettingsBase { + + private static ShowCommandSettings defaultInstance = ((ShowCommandSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new ShowCommandSettings()))); + + public static ShowCommandSettings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double ShowOneCommandTop { + get { + return ((double)(this["ShowOneCommandTop"])); + } + set { + this["ShowOneCommandTop"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double ShowOneCommandLeft { + get { + return ((double)(this["ShowOneCommandLeft"])); + } + set { + this["ShowOneCommandLeft"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double ShowOneCommandWidth { + get { + return ((double)(this["ShowOneCommandWidth"])); + } + set { + this["ShowOneCommandWidth"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double ShowOneCommandHeight { + get { + return ((double)(this["ShowOneCommandHeight"])); + } + set { + this["ShowOneCommandHeight"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double ShowCommandsTop { + get { + return ((double)(this["ShowCommandsTop"])); + } + set { + this["ShowCommandsTop"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double ShowCommandsLeft { + get { + return ((double)(this["ShowCommandsLeft"])); + } + set { + this["ShowCommandsLeft"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double ShowCommandsWidth { + get { + return ((double)(this["ShowCommandsWidth"])); + } + set { + this["ShowCommandsWidth"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("-1")] + public double ShowCommandsHeight { + get { + return ((double)(this["ShowCommandsHeight"])); + } + set { + this["ShowCommandsHeight"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool ShowCommandsWindowMaximized { + get { + return ((bool)(this["ShowCommandsWindowMaximized"])); + } + set { + this["ShowCommandsWindowMaximized"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool ShowOneCommandWindowMaximized { + get { + return ((bool)(this["ShowOneCommandWindowMaximized"])); + } + set { + this["ShowOneCommandWindowMaximized"] = value; + } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.settings b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.settings new file mode 100644 index 00000000000..6f6c457d258 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.settings @@ -0,0 +1,36 @@ + + + + + + -1 + + + -1 + + + -1 + + + -1 + + + -1 + + + -1 + + + -1 + + + -1 + + + False + + + False + + + \ No newline at end of file diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/AllModulesViewModel.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/AllModulesViewModel.cs new file mode 100644 index 00000000000..3b53366dc73 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/AllModulesViewModel.cs @@ -0,0 +1,659 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Management.Automation; +using System.Windows; + +using Microsoft.Management.UI.Internal; +using Microsoft.PowerShell.Commands.ShowCommandExtension; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Contains all Commands, Parameters, ParameterSet and Common Parameter. + /// + public class AllModulesViewModel : INotifyPropertyChanged + { + #region Private Fields + /// + /// Flag indicating a wait message is being displayed + /// + private bool waitMessageDisplayed; + + /// + /// True if this ViewModel is not supposed to show common parameters + /// + private bool noCommonParameter; + + /// + /// the filterName of command + /// + private string commandNameFilter; + + /// + /// Field used for the Modules property. + /// + private List modules; + + /// + /// true if a command can be run + /// + private bool canRun; + + /// + /// true if a command can be copied + /// + private bool canCopy; + + /// + /// the selected module being displayed in the GUI + /// + private ModuleViewModel selectedModule; + + /// + /// the visibility of the refresh button + /// + private Visibility refreshVisibility = Visibility.Collapsed; + + /// + /// Provides an extra viewModel object that allows callers to control certain aspects of the GUI + /// + private object extraViewModel; + + /// + /// private property for ZoomLevel + /// + private double zoomLevel = 1.0; + #endregion + + #region Construction and Destructor + /// + /// Initializes a new instance of the AllModulesViewModel class + /// + /// the loaded modules + /// commands to show + public AllModulesViewModel(Dictionary importedModules, IEnumerable commands) + { + if (commands == null || !commands.GetEnumerator().MoveNext()) + { + throw new ArgumentNullException("commands"); + } + + this.Initialization(importedModules, commands, true); + } + + /// + /// Initializes a new instance of the AllModulesViewModel class + /// + /// the loaded modules + /// All PowerShell commands + /// true not to show common parameters + public AllModulesViewModel(Dictionary importedModules, IEnumerable commands, bool noCommonParameter) + { + if (commands == null) + { + throw new ArgumentNullException("commands"); + } + + this.Initialization(importedModules, commands, noCommonParameter); + } + + #endregion + + #region INotifyPropertyChanged Members + /// + /// PropertyChanged Event + /// + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + /// + /// Indicates the selected command in the selected module needs to display the help for a command + /// + public event EventHandler SelectedCommandInSelectedModuleNeedsHelp; + + /// + /// Indicates the selected command in the selected module needs to import a module for a command + /// + public event EventHandler SelectedCommandInSelectedModuleNeedsImportModule; + + /// + /// Indicates the selected command in the selected module should be run + /// + public event EventHandler RunSelectedCommandInSelectedModule; + + /// + /// Indicates we want to refresh the viewModel + /// + public event EventHandler Refresh; + + #region Public Properties + + /// + /// Get or Sets Zoom level + /// + public double ZoomLevel + { + get + { + return this.zoomLevel; + } + + set + { + if (value > 0) + { + this.zoomLevel = value / 100.0; + this.OnNotifyPropertyChanged("ZoomLevel"); + } + } + } + + /// + /// Gets the tooltip for the refresh button + /// + public static string RefreshTooltip + { + get { return String.Format(CultureInfo.CurrentUICulture, ShowCommandResources.RefreshShowCommandTooltipFormat, "import-module"); } + } + + /// + /// Gets or sets the visibility of the refresh button + /// + public Visibility RefreshVisibility + { + get + { + return this.refreshVisibility; + } + + set + { + if (this.refreshVisibility == value) + { + return; + } + + this.refreshVisibility = value; + this.OnNotifyPropertyChanged("RefreshVisibility"); + } + } + + /// + /// Gets a value indicating whether common parameters are displayed + /// + public bool NoCommonParameter + { + get { return this.noCommonParameter; } + } + + /// + /// Gets or sets the filterName of command + /// + public string CommandNameFilter + { + get + { + return this.commandNameFilter; + } + + set + { + if (this.CommandNameFilter == value) + { + return; + } + + this.commandNameFilter = value; + if (this.selectedModule != null) + { + this.selectedModule.RefreshFilteredCommands(this.CommandNameFilter); + this.selectedModule.SelectedCommand = null; + } + + this.OnNotifyPropertyChanged("CommandNameFilter"); + } + } + + /// + /// Gets or sets the selected module being displayed in the GUI + /// + public ModuleViewModel SelectedModule + { + get + { + return this.selectedModule; + } + + set + { + if (this.selectedModule == value) + { + return; + } + + if (this.selectedModule != null) + { + this.selectedModule.SelectedCommandNeedsImportModule -= new EventHandler(this.SelectedModule_SelectedCommandNeedsImportModule); + this.selectedModule.SelectedCommandNeedsHelp -= new EventHandler(this.SelectedModule_SelectedCommandNeedsHelp); + this.selectedModule.RunSelectedCommand -= new EventHandler(this.SelectedModule_RunSelectedCommand); + this.selectedModule.PropertyChanged -= new PropertyChangedEventHandler(this.SelectedModule_PropertyChanged); + } + + this.selectedModule = value; + this.SetCanRun(); + this.SetCanCopy(); + + if (this.selectedModule != null) + { + this.selectedModule.RefreshFilteredCommands(this.CommandNameFilter); + this.selectedModule.SelectedCommandNeedsImportModule += new EventHandler(this.SelectedModule_SelectedCommandNeedsImportModule); + this.selectedModule.SelectedCommandNeedsHelp += new EventHandler(this.SelectedModule_SelectedCommandNeedsHelp); + this.selectedModule.RunSelectedCommand += new EventHandler(this.SelectedModule_RunSelectedCommand); + this.selectedModule.PropertyChanged += new PropertyChangedEventHandler(this.SelectedModule_PropertyChanged); + this.selectedModule.SelectedCommand = null; + } + + this.OnNotifyPropertyChanged("SelectedModule"); + } + } + + /// + /// Gets a value indicating whether we can run a command + /// + public bool CanRun + { + get + { + return this.canRun; + } + } + + /// + /// Gets a value indicating whether we can copy a command + /// + public bool CanCopy + { + get + { + return this.canCopy; + } + } + + /// + /// Gets the Modules parameter. + /// + public List Modules + { + get { return this.modules; } + } + + /// + /// Gets the visibility of the wait message + /// + public Visibility WaitMessageVisibility + { + get + { + return this.waitMessageDisplayed ? Visibility.Visible : Visibility.Hidden; + } + } + + /// + /// Gets the visibility of the main grid + /// + public Visibility MainGridVisibility + { + get + { + return this.waitMessageDisplayed ? Visibility.Hidden : Visibility.Visible; + } + } + + /// + /// Gets a value indicating whether the main grid is displayed + /// + public bool MainGridDisplayed + { + get + { + return !this.waitMessageDisplayed; + } + } + + /// + /// Gets or sets a value indicating whether the wait message is displayed + /// + public bool WaitMessageDisplayed + { + get + { + return this.waitMessageDisplayed; + } + + set + { + if (this.waitMessageDisplayed == value) + { + return; + } + + this.waitMessageDisplayed = value; + this.SetCanCopy(); + this.SetCanRun(); + this.OnNotifyPropertyChanged("WaitMessageDisplayed"); + this.OnNotifyPropertyChanged("WaitMessageVisibility"); + this.OnNotifyPropertyChanged("MainGridDisplayed"); + this.OnNotifyPropertyChanged("MainGridVisibility"); + } + } + + /// + /// Gets or sets an extra viewModel object that allows callers to control certain aspects of the GUI + /// + public object ExtraViewModel + { + get + { + return this.extraViewModel; + } + + set + { + if (this.extraViewModel == value) + { + return; + } + + this.extraViewModel = value; + this.OnNotifyPropertyChanged("ExtraViewModel"); + } + } + #endregion + + /// + /// Returns the selected script + /// + /// the selected script + public string GetScript() + { + if (this.SelectedModule == null) + { + return null; + } + + if (this.SelectedModule.SelectedCommand == null) + { + return null; + } + + return this.SelectedModule.SelectedCommand.GetScript(); + } + + /// + /// Triggers Refresh + /// + internal void OnRefresh() + { + EventHandler handler = this.Refresh; + if (handler != null) + { + handler(this, new EventArgs()); + } + } + + #region Private Methods + /// + /// If current modules name is ALL, then return true. + /// + /// The modules name + /// Return true is the module name is ALLModulesViewModel. + private static bool IsAll(string name) + { + return name.Equals(ShowCommandResources.All, StringComparison.Ordinal); + } + + /// + /// Monitors property changes in the selected module to call: + /// SetCanRun for IsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues + /// SetCanCopy for SetCanCopy + /// + /// event sender + /// event arguments + private void SelectedModule_PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (e.PropertyName == "IsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues") + { + this.SetCanRun(); + } + else if (e.PropertyName == "IsThereASelectedCommand") + { + this.SetCanCopy(); + } + } + + /// + /// Called to set this.CanRun when: + /// The SelectedModule changes, since there will be no selected command in the new module, and CanRun should be false + /// WaitMessageDisplayedMessage changes since this being true will cause this.MainGridDisplayed to be false and CanRun should be false + /// IsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues changes in the selected module + /// + private void SetCanRun() + { + bool newValue = this.selectedModule != null && this.MainGridDisplayed && + this.selectedModule.IsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues; + + if (this.canRun == newValue) + { + return; + } + + this.canRun = newValue; + this.OnNotifyPropertyChanged("CanRun"); + } + + /// + /// Called to set this.CanCopy when: + /// The SelectedModule changes, since there will be no selected command in the new module, and CanCopy should be false + /// WaitMessageDisplayedMessage changes since this being true will cause this.MainGridDisplayed to be false and CanCopy should be false + /// IsThereASelectedCommand changes in the selected module + /// + private void SetCanCopy() + { + bool newValue = this.selectedModule != null && this.MainGridDisplayed && this.selectedModule.IsThereASelectedCommand; + + if (this.canCopy == newValue) + { + return; + } + + this.canCopy = newValue; + this.OnNotifyPropertyChanged("CanCopy"); + } + + /// + /// Initialize AllModulesViewModel. + /// + /// All loaded modules + /// List of commands in all modules + /// Whether showing common parameter + private void Initialization(Dictionary importedModules, IEnumerable commands, bool noCommonParameterInModel) + { + if (commands == null) + { + return; + } + + Dictionary rawModuleViewModels = new Dictionary(); + + this.noCommonParameter = noCommonParameterInModel; + + // separates commands in their Modules + foreach (ShowCommandCommandInfo command in commands) + { + ModuleViewModel moduleViewModel; + if (!rawModuleViewModels.TryGetValue(command.ModuleName, out moduleViewModel)) + { + moduleViewModel = new ModuleViewModel(command.ModuleName, importedModules); + rawModuleViewModels.Add(command.ModuleName, moduleViewModel); + } + + CommandViewModel commandViewModel; + + try + { + commandViewModel = CommandViewModel.GetCommandViewModel(moduleViewModel, command, noCommonParameterInModel); + } + catch (RuntimeException) + { + continue; + } + + moduleViewModel.Commands.Add(commandViewModel); + moduleViewModel.SetAllModules(this); + } + + // populates this.modules + this.modules = new List(); + + // if there is just one module then use only it + if (rawModuleViewModels.Values.Count == 1) + { + this.modules.Add(rawModuleViewModels.Values.First()); + this.modules[0].SortCommands(false); + this.SelectedModule = this.modules[0]; + return; + } + + // If there are more modules, create an additional module to agregate all commands + ModuleViewModel allCommandsModule = new ModuleViewModel(ShowCommandResources.All, null); + this.modules.Add(allCommandsModule); + allCommandsModule.SetAllModules(this); + + if (rawModuleViewModels.Values.Count > 0) + { + foreach (ModuleViewModel module in rawModuleViewModels.Values) + { + module.SortCommands(false); + this.modules.Add(module); + + allCommandsModule.Commands.AddRange(module.Commands); + } + } + + allCommandsModule.SortCommands(true); + + this.modules.Sort(this.Compare); + this.SelectedModule = this.modules.Count == 0 ? null : this.modules[0]; + } + + /// + /// Compare two ModuleViewModel target and source. + /// + /// The source ModuleViewModel + /// The target ModuleViewModel + /// Compare result + private int Compare(ModuleViewModel source, ModuleViewModel target) + { + if (AllModulesViewModel.IsAll(source.Name) && !AllModulesViewModel.IsAll(target.Name)) + { + return -1; + } + + if (!AllModulesViewModel.IsAll(source.Name) && AllModulesViewModel.IsAll(target.Name)) + { + return 1; + } + + return String.Compare(source.Name, target.Name, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Called when the SelectedCommandNeedsHelp event is triggered in the Selected Module + /// + /// event sender + /// event arguments + private void SelectedModule_SelectedCommandNeedsHelp(object sender, HelpNeededEventArgs e) + { + this.OnSelectedCommandInSelectedModuleNeedsHelp(e); + } + + /// + /// Called when the SelectedCommandNeedsImportModule event is triggered in the Selected Module + /// + /// event sender + /// event arguments + private void SelectedModule_SelectedCommandNeedsImportModule(object sender, ImportModuleEventArgs e) + { + this.OnSelectedCommandInSelectedModuleNeedsImportModule(e); + } + + /// + /// Triggers SelectedCommandInSelectedModuleNeedsHelp + /// + /// event arguments + private void OnSelectedCommandInSelectedModuleNeedsHelp(HelpNeededEventArgs e) + { + EventHandler handler = this.SelectedCommandInSelectedModuleNeedsHelp; + if (handler != null) + { + handler(this, e); + } + } + + /// + /// Triggers SelectedCommandInSelectedModuleNeedsImportModule + /// + /// event arguments + private void OnSelectedCommandInSelectedModuleNeedsImportModule(ImportModuleEventArgs e) + { + EventHandler handler = this.SelectedCommandInSelectedModuleNeedsImportModule; + if (handler != null) + { + handler(this, e); + } + } + + /// + /// Called when the RunSelectedCommand is triggered in the selected module + /// + /// event sender + /// event arguments + private void SelectedModule_RunSelectedCommand(object sender, CommandEventArgs e) + { + this.OnRunSelectedCommandInSelectedModule(e); + } + + /// + /// Triggers RunSelectedCommandInSelectedModule + /// + /// event arguments + private void OnRunSelectedCommandInSelectedModule(CommandEventArgs e) + { + EventHandler handler = this.RunSelectedCommandInSelectedModule; + if (handler != null) + { + handler(this, e); + } + } + + /// + /// If property changed will be notify + /// + /// The changed property + private void OnNotifyPropertyChanged(string propertyName) + { + PropertyChangedEventHandler handler = this.PropertyChanged; + if (handler != null) + { + handler (this, new PropertyChangedEventArgs(propertyName)); + } + } + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandEventArgs.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandEventArgs.cs new file mode 100644 index 00000000000..52fad0cc159 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandEventArgs.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Arguments for the event triggered when something happens at the cmdlet level + /// + public class CommandEventArgs : EventArgs + { + /// + /// the command targeted by the event + /// + private CommandViewModel command; + + /// + /// Initializes a new instance of the CommandEventArgs class. + /// + /// the command targeted by the event + public CommandEventArgs(CommandViewModel command) + { + this.command = command; + } + + /// + /// Gets the command targeted by the event + /// + public CommandViewModel Command + { + get { return this.command; } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandViewModel.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandViewModel.cs new file mode 100644 index 00000000000..528e0e822c4 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandViewModel.cs @@ -0,0 +1,650 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Windows; + +using SMAI = System.Management.Automation.Internal; + +using Microsoft.Management.UI; +using Microsoft.Management.UI.Internal; +using Microsoft.PowerShell.Commands.ShowCommandExtension; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Contains information about a cmdlet's Shard ParameterSet, + /// ParameterSets, Parameters, Common Parameters and error message. + /// + public class CommandViewModel : INotifyPropertyChanged + { + #region Private Fields + /// + /// The name of the AllParameterSets + /// + private const string SharedParameterSetName = "__AllParameterSets"; + + /// + /// Grid length constant + /// + private static readonly GridLength star = new GridLength(1, GridUnitType.Star); + + /// + /// The module containing this cmdlet in the gui + /// + private ModuleViewModel parentModule; + + /// + /// The name of the default ParameterSet + /// + private string defaultParameterSetName; + + /// + /// Field used for the AreCommonParametersExpanded parameter. + /// + private bool areCommonParametersExpanded; + + /// + /// Field used for the SelectedParameterSet parameter. + /// + private ParameterSetViewModel selectedParameterSet; + + /// + /// Field used for the ParameterSets parameter. + /// + private List parameterSets = new List(); + + /// + /// Field used for the ParameterSetTabControlVisibility parameter. + /// + private bool noCommonParameters; + + /// + /// Field used for the CommonParameters parameter. + /// + private ParameterSetViewModel comonParameters; + + /// + /// The ShowCommandCommandInfo this model is based on + /// + private ShowCommandCommandInfo commandInfo; + + /// + /// value indicating whether the selected parameter set has all mandatory parameters valid + /// + private bool selectedParameterSetAllMandatoryParametersHaveValues; + + /// + /// value indicating whether the command name should be qualified by the module in GetScript + /// + private bool moduleQualifyCommandName; + + /// + /// The height for common parameters that will depend on CommonParameterVisibility + /// + private GridLength commonParametersHeight; + #endregion + + /// + /// Prevents a default instance of the CommandViewModel class from being created + /// + private CommandViewModel() + { + } + + #region INotifyPropertyChanged Members + + /// + /// PropertyChanged Event + /// + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + + /// + /// Indicates the command needs to display the help for a command + /// + public event EventHandler HelpNeeded; + + /// + /// Indicates a module needs to be imported + /// + public event EventHandler ImportModule; + + #region Public Properties + /// + /// Gets or sets a value indicating whether the command name should be qualified by the module in GetScript + /// + public bool ModuleQualifyCommandName + { + get { return this.moduleQualifyCommandName; } + set { this.moduleQualifyCommandName = value; } + } + + /// + /// Gets or sets a value indicating whether the common parameters are expanded + /// + public bool AreCommonParametersExpanded + { + get + { + return this.areCommonParametersExpanded; + } + + set + { + if (this.areCommonParametersExpanded == value) + { + return; + } + + this.areCommonParametersExpanded = value; + this.OnNotifyPropertyChanged("AreCommonParametersExpanded"); + this.SetCommonParametersHeight(); + } + } + + /// + /// Gets or sets the SelectedParameterSet parameter. + /// + public ParameterSetViewModel SelectedParameterSet + { + get + { + return this.selectedParameterSet; + } + + set + { + if (this.selectedParameterSet != value) + { + if (this.selectedParameterSet != null) + { + this.selectedParameterSet.PropertyChanged -= new PropertyChangedEventHandler(this.SelectedParameterSet_PropertyChanged); + } + + this.selectedParameterSet = value; + if (this.selectedParameterSet != null) + { + this.selectedParameterSet.PropertyChanged += new PropertyChangedEventHandler(this.SelectedParameterSet_PropertyChanged); + this.SelectedParameterSetAllMandatoryParametersHaveValues = this.SelectedParameterSet.AllMandatoryParametersHaveValues; + } + else + { + this.SelectedParameterSetAllMandatoryParametersHaveValues = true; + } + + this.OnNotifyPropertyChanged("SelectedParameterSet"); + } + } + } + + /// + /// Gets or sets a value indicating whether the selected parameter set has all mandatory parameters valid. + /// If there is no selected parameter set this value is true + /// + public bool SelectedParameterSetAllMandatoryParametersHaveValues + { + get + { + return this.selectedParameterSetAllMandatoryParametersHaveValues; + } + + set + { + if (this.selectedParameterSetAllMandatoryParametersHaveValues == value) + { + return; + } + + this.selectedParameterSetAllMandatoryParametersHaveValues = value; + this.OnNotifyPropertyChanged("SelectedParameterSetAllMandatoryParametersHaveValues"); + } + } + + /// + /// Gets the ParameterSets parameter. + /// + public List ParameterSets + { + get { return this.parameterSets; } + } + + /// + /// Gets the visibility for the tab control displaying several ParameterSetControl. This is displayed when there are more than 1 parameter sets. + /// + public Visibility ParameterSetTabControlVisibility + { + get { return (this.ParameterSets.Count > 1) && this.IsImported ? Visibility.Visible : Visibility.Collapsed; } + } + + /// + /// Gets the visibility for the single ParameterSetControl displayed when there is only 1 parameter set + /// + public Visibility SingleParameterSetControlVisibility + { + get { return (this.ParameterSets.Count == 1) ? Visibility.Visible : Visibility.Collapsed; } + } + + /// + /// Gets the CommonParameters parameter. + /// + public ParameterSetViewModel CommonParameters + { + get { return this.comonParameters; } + } + + /// + /// Gets the CommonParameterVisibility parameter. + /// + public Visibility CommonParameterVisibility + { + get { return this.noCommonParameters || (this.CommonParameters.Parameters.Count == 0) ? Visibility.Collapsed : Visibility.Visible; } + } + + /// + /// Gets or sets the height for common parameters that will depend on CommonParameterVisibility + /// + public GridLength CommonParametersHeight + { + get + { + return this.commonParametersHeight; + } + + set + { + if (this.commonParametersHeight == value) + { + return; + } + + this.commonParametersHeight = value; + this.OnNotifyPropertyChanged("CommonParametersHeight"); + } + } + + /// + /// Gets the visibility for the control displayed when the module is not imported + /// + public Visibility NotImportedVisibility + { + get + { + return this.IsImported ? Visibility.Collapsed : Visibility.Visible; + } + } + + /// + /// Gets the visibility for the control displayed when there are no parameters + /// + public Visibility NoParameterVisibility + { + get + { + bool hasNoParameters = this.ParameterSets.Count == 0 || (this.ParameterSets.Count == 1 && this.ParameterSets[0].Parameters.Count == 0); + return this.IsImported && hasNoParameters ? Visibility.Visible : Visibility.Collapsed; + } + } + + /// + /// Gets a value indicating whether the cmdlet comes from a module which is imported + /// + public bool IsImported + { + get + { + return this.commandInfo.Module == null || this.ParentModule.IsModuleImported; + } + } + + /// + /// Gets the Name parameter. + /// + public string Name + { + get + { + if (this.commandInfo != null) + { + return this.commandInfo.Name; + } + + return string.Empty; + } + } + + /// + /// Gets the module path if it is not null or empty, or the name otherwise + /// + public string ModuleName + { + get + { + if (this.commandInfo != null && this.commandInfo.ModuleName != null) + { + return this.commandInfo.ModuleName; + } + + return string.Empty; + } + } + + /// + /// Gets the module containing this cmdlet in the GUI. + /// + public ModuleViewModel ParentModule + { + get + { + return this.parentModule; + } + } + + /// + /// Gets Tooltip string for the cmdlet + /// + public string ToolTip + { + get + { + return String.Format( + CultureInfo.CurrentCulture, + ShowCommandResources.CmdletTooltipFormat, + this.Name, + this.ParentModule.DisplayName, + this.IsImported ? ShowCommandResources.Imported : ShowCommandResources.NotImported); + } + } + + /// + /// Gets the message to be displayed when the cmdlet belongs to a module that is not imported + /// + public string ImportModuleMessage + { + get + { + return String.Format( + CultureInfo.CurrentCulture, + ShowCommandResources.NotImportedFormat, + this.ModuleName, + this.Name, + ShowCommandResources.ImportModuleButtonText); + } + } + + /// + /// Gets the title for the cmdlet details + /// + public string DetailsTitle + { + get + { + if (this.IsImported) + { + return String.Format( + CultureInfo.CurrentCulture, + ShowCommandResources.DetailsParameterTitleFormat, + this.Name); + } + else + { + return String.Format( + CultureInfo.CurrentCulture, + ShowCommandResources.NameLabelFormat, + this.Name); + } + } + } + #endregion + + /// + /// Gets a Grid length constant + /// + internal static GridLength Star + { + get { return CommandViewModel.star; } + } + + /// + /// Gets the builded PowerShell script. + /// + /// Return script as string + public string GetScript() + { + StringBuilder builder = new StringBuilder(); + + string commandName = this.commandInfo.CommandType == CommandTypes.ExternalScript ? this.commandInfo.Definition : this.Name; + + if (this.ModuleQualifyCommandName && !String.IsNullOrEmpty(this.ModuleName)) + { + commandName = this.ModuleName + "\\" + commandName; + } + + if (commandName.IndexOf(' ') != -1) + { + builder.AppendFormat("& \"{0}\"", commandName); + } + else + { + builder.Append(commandName); + } + + builder.Append(" "); + + if (this.SelectedParameterSet != null) + { + builder.Append(this.SelectedParameterSet.GetScript()); + builder.Append(" "); + } + + if (this.CommonParameters != null) + { + builder.Append(this.CommonParameters.GetScript()); + } + + string script = builder.ToString(); + + return script.Trim(); + } + + /// + /// Showing help information for current actived cmdlet. + /// + public void OpenHelpWindow() + { + this.OnHelpNeeded(); + } + + /// + /// Determins whether current command name and a specifed ParameterSetName have same name. + /// + /// The name of ShareParameterSet + /// Return true is ShareParameterSet. Else return false. + internal static bool IsSharedParameterSetName(string name) + { + return name.Equals(CommandViewModel.SharedParameterSetName, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Creates a new CommandViewModel out the . + /// + /// Module to which the CommandViewModel will belong to + /// Will showing command + /// true to ommit displaying common parameter + /// If commandInfo is null + /// + /// If could not create the CommandViewModel. For instance the ShowCommandCommandInfo corresponding to + /// the following function will throw a RuntimeException when the ShowCommandCommandInfo Parameters + /// are retrieved: + /// function CrashMe ([I.Am.A.Type.That.Does.Not.Exist]$name) {} + /// + /// The CommandViewModel corresponding to commandInfo + internal static CommandViewModel GetCommandViewModel(ModuleViewModel module, ShowCommandCommandInfo commandInfo, bool noCommonParameters) + { + if (commandInfo == null) + { + throw new ArgumentNullException("commandInfo"); + } + + CommandViewModel returnValue = new CommandViewModel(); + returnValue.commandInfo = commandInfo; + returnValue.noCommonParameters = noCommonParameters; + returnValue.parentModule = module; + + Dictionary commonParametersTable = new Dictionary(); + + bool isWorkflow = (commandInfo.CommandType & CommandTypes.Workflow) != 0; + + foreach (ShowCommandParameterSetInfo parameterSetInfo in commandInfo.ParameterSets) + { + if (parameterSetInfo.IsDefault) + { + returnValue.defaultParameterSetName = parameterSetInfo.Name; + } + + List parametersForParameterSet = new List(); + foreach (ShowCommandParameterInfo parameterInfo in parameterSetInfo.Parameters) + { + bool isCommon = Cmdlet.CommonParameters.Contains(parameterInfo.Name); + + if (isCommon) + { + if (!commonParametersTable.ContainsKey(parameterInfo.Name)) + { + commonParametersTable.Add(parameterInfo.Name, new ParameterViewModel(parameterInfo, parameterSetInfo.Name)); + } + + continue; + } + + parametersForParameterSet.Add(new ParameterViewModel(parameterInfo, parameterSetInfo.Name)); + } + + if (parametersForParameterSet.Count != 0) + { + returnValue.ParameterSets.Add(new ParameterSetViewModel(parameterSetInfo.Name, parametersForParameterSet)); + } + } + + List commonParametersList = commonParametersTable.Values.ToList(); + returnValue.comonParameters = new ParameterSetViewModel(String.Empty, commonParametersList); + + returnValue.parameterSets.Sort(returnValue.Compare); + + if (returnValue.parameterSets.Count > 0) + { + // Setting SelectedParameterSet will also set SelectedParameterSetAllMandatoryParametersHaveValues + returnValue.SelectedParameterSet = returnValue.ParameterSets[0]; + } + else + { + returnValue.SelectedParameterSetAllMandatoryParametersHaveValues = true; + } + + returnValue.SetCommonParametersHeight(); + + return returnValue; + } + + /// + /// Called to trigger the event fired when help is needed for the command + /// + internal void OnHelpNeeded() + { + EventHandler handler = this.HelpNeeded; + if (handler != null) + { + handler(this, new HelpNeededEventArgs(this.Name)); + } + } + + /// + /// Called to trigger the event fired when a module needs to be imported + /// + internal void OnImportModule() + { + EventHandler handler = this.ImportModule; + if (handler != null) + { + handler(this, new EventArgs()); + } + } + + #region Private Methods + /// + /// Called to set the height for common parameters initially or when the AreCommonParametersExpanded changes + /// + private void SetCommonParametersHeight() + { + this.CommonParametersHeight = this.AreCommonParametersExpanded ? CommandViewModel.Star : GridLength.Auto; + } + + /// + /// Compares source and target by being the default parameter set and then by name + /// + /// source paremeterset + /// target parameterset + /// 0 if they are the same, -1 if source is smaller, 1 if source is larger + private int Compare(ParameterSetViewModel source, ParameterSetViewModel target) + { + if (this.defaultParameterSetName != null) + { + if (source.Name.Equals(this.defaultParameterSetName) && target.Name.Equals(this.defaultParameterSetName)) + { + return 0; + } + + if (source.Name.Equals(this.defaultParameterSetName, StringComparison.Ordinal)) + { + return -1; + } + + if (target.Name.Equals(this.defaultParameterSetName, StringComparison.Ordinal)) + { + return 1; + } + } + + return String.Compare(source.Name, target.Name, StringComparison.Ordinal); + } + + /// + /// If property changed will be notify + /// + /// The changed property + private void OnNotifyPropertyChanged(string propertyName) + { + PropertyChangedEventHandler handler = this.PropertyChanged; + if (handler != null) + { + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// Called when the PropertyChanged event is triggered on the SelectedParameterSet + /// + /// event sender + /// event arguments + private void SelectedParameterSet_PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (!e.PropertyName.Equals("AllMandatoryParametersHaveValues")) + { + return; + } + + this.SelectedParameterSetAllMandatoryParametersHaveValues = this.SelectedParameterSet.AllMandatoryParametersHaveValues; + } + + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/HelpNeededEventArgs.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/HelpNeededEventArgs.cs new file mode 100644 index 00000000000..4fd1977b95d --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/HelpNeededEventArgs.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Arguments for the event triggered when it is necessary to display help for a command + /// + public class HelpNeededEventArgs : EventArgs + { + /// + /// the name for the command needing help + /// + private string commandName; + + /// + /// Initializes a new instance of the HelpNeededEventArgs class. + /// + /// the name for the command needing help + public HelpNeededEventArgs(string commandName) + { + this.commandName = commandName; + } + + /// + /// Gets the name for the command needing help + /// + public string CommandName + { + get { return this.commandName; } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ImportModuleEventArgs.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ImportModuleEventArgs.cs new file mode 100644 index 00000000000..27d99b7abe8 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ImportModuleEventArgs.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Arguments for the event triggered when it is necessary to display help for a command + /// + public class ImportModuleEventArgs : EventArgs + { + /// + /// the name for the command belonging to the module to be imported + /// + private string commandName; + + /// + /// the module path or name for the module we want to import + /// + private string parentModuleName; + + /// + /// the name of the module that is selected, which can be different from parentModuleName + /// if "All" is selected + /// + private string selectedModuleName; + + /// + /// Initializes a new instance of the ImportModuleEventArgs class. + /// + /// the name for the command needing help + /// the name of the module containing the command + /// + /// the name of the module that is selected, which can be different from parentModuleName + /// if "All" is selected + /// + public ImportModuleEventArgs(string commandName, string parentModuleName, string selectedModuleName) + { + this.commandName = commandName; + this.parentModuleName = parentModuleName; + this.selectedModuleName = selectedModuleName; + } + + /// + /// Gets the name for the command belonging to the module to be imported + /// + public string CommandName + { + get { return this.commandName; } + } + + /// + /// Gets the module path or name for the module we want to import + /// + public string ParentModuleName + { + get { return this.parentModuleName; } + } + + /// + /// Gets the name of the module that is selected, which can be different from parentModuleName + /// if "All" is selected + /// + public string SelectedModuleName + { + get { return this.selectedModuleName; } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ModuleViewModel.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ModuleViewModel.cs new file mode 100644 index 00000000000..2dad74c2649 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ModuleViewModel.cs @@ -0,0 +1,531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Management.Automation; +using System.Windows; + +using Microsoft.Management.UI.Internal; +using Microsoft.PowerShell.Commands.ShowCommandExtension; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// ModuleViewModel Contains information about a PowerShell module. + /// + public class ModuleViewModel : INotifyPropertyChanged + { + /// + /// True if the module is imported + /// + private bool isModuleImported; + + /// + /// Field used for the Name parameter. + /// + private string name; + + /// + /// Filter commands property of this module + /// + private ObservableCollection filteredCommands; + + /// + /// The selected command property of this module + /// + private CommandViewModel selectedCommand; + + /// + /// Field used for the Commands parameter. + /// + private List commands; + + /// + /// value indicating whether there is a selected command which belongs to an imported module, + /// with no parameter sets or with a selected parameter set where all mandatory parameters have values + /// + private bool isThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues; + + /// + /// value indicating whether there is a selected command + /// + private bool isThereASelectedCommand; + + /// + /// The AllModulesViewModel containing this, if any + /// + private AllModulesViewModel allModules; + + #region Construction and Destructor + /// + /// Initializes a new instance of the ModuleViewModel class. + /// + /// Module name + /// All loaded modules + public ModuleViewModel(string name, Dictionary importedModules) + { + if (name == null) + { + throw new ArgumentNullException("name"); + } + + this.name = name; + this.commands = new List(); + this.filteredCommands = new ObservableCollection(); + + // This check looks to see if the given module name shows up in + // the set of modules that are known to be imported in the current + // session. In remote PowerShell sessions, the core cmdlet module + // Microsoft.PowerShell.Core doesn't appear as being imported despite + // always being loaded by default. To make sure we don't incorrectly + // mark this module as not imported, check for it by name. + this.isModuleImported = + importedModules == null ? true : name.Length == 0 || + importedModules.ContainsKey(name) || + string.Equals("Microsoft.PowerShell.Core", name, StringComparison.OrdinalIgnoreCase); + } + #endregion + + #region INotifyPropertyChanged Members + + /// + /// PropertyChanged Event + /// + public event PropertyChangedEventHandler PropertyChanged; + #endregion + + /// + /// Indicates the selected command in needs to display the help for a command + /// + public event EventHandler SelectedCommandNeedsHelp; + + /// + /// Indicates the selected command needs to import a module + /// + public event EventHandler SelectedCommandNeedsImportModule; + + /// + /// Indicates the selected command should be run + /// + public event EventHandler RunSelectedCommand; + + #region Public Property + /// + /// Gets the name property of this ModuleView + /// + public string Name + { + get { return this.name; } + } + + /// + /// Gets the GUI friendly module name + /// + public string DisplayName + { + get + { + if (!String.IsNullOrEmpty(this.name)) + { + return this.name; + } + + return ShowCommandResources.NoModuleName; + } + } + + /// + /// Gets CommandControl is visibility or not + /// + public Visibility CommandControlVisibility + { + get { return this.selectedCommand == null ? Visibility.Collapsed : Visibility.Visible; } + } + + /// + /// Gets CommandControl Height + /// + public GridLength CommandRowHeight + { + get { return this.selectedCommand == null ? GridLength.Auto : CommandViewModel.Star; } + } + + /// + /// Gets the commands under in this module + /// + public List Commands + { + get { return this.commands; } + } + + /// + /// Gets the filter commands of this module + /// + public ObservableCollection FilteredCommands + { + get { return this.filteredCommands; } + } + + /// + /// Gets or sets the selected commands of this module + /// + public CommandViewModel SelectedCommand + { + get + { + return this.selectedCommand; + } + + set + { + if (value == this.selectedCommand) + { + return; + } + + if (this.selectedCommand != null) + { + this.selectedCommand.PropertyChanged -= new PropertyChangedEventHandler(this.SelectedCommand_PropertyChanged); + this.selectedCommand.HelpNeeded -= new EventHandler(this.SelectedCommand_HelpNeeded); + this.selectedCommand.ImportModule -= new EventHandler(this.SelectedCommand_ImportModule); + } + + this.selectedCommand = value; + + this.SetIsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues(); + + if (this.selectedCommand != null) + { + this.selectedCommand.PropertyChanged += new PropertyChangedEventHandler(this.SelectedCommand_PropertyChanged); + this.selectedCommand.HelpNeeded += new EventHandler(this.SelectedCommand_HelpNeeded); + this.selectedCommand.ImportModule += new EventHandler(this.SelectedCommand_ImportModule); + this.IsThereASelectedCommand = true; + } + else + { + this.IsThereASelectedCommand = false; + } + + this.OnNotifyPropertyChanged("SelectedCommand"); + this.OnNotifyPropertyChanged("CommandControlVisibility"); + this.OnNotifyPropertyChanged("CommandRowHeight"); + } + } + + /// + /// Gets or sets a value indicating whether there is a selected command + /// + public bool IsThereASelectedCommand + { + get + { + return this.isThereASelectedCommand; + } + + set + { + if (value == this.isThereASelectedCommand) + { + return; + } + + this.isThereASelectedCommand = value; + this.OnNotifyPropertyChanged("IsThereASelectedCommand"); + } + } + + /// + /// Gets or sets a value indicating whether there is a selected command which belongs + /// to an imported module, with no parameter sets or with a selected parameter set + /// where all mandatory parameters have values + /// + public bool IsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues + { + get + { + return this.isThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues; + } + + set + { + if (value == this.isThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues) + { + return; + } + + this.isThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues = value; + + this.OnNotifyPropertyChanged("IsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues"); + } + } + + /// + /// Gets the AllModulesViewModel containing this, if any + /// + public AllModulesViewModel AllModules + { + get + { + return this.allModules; + } + } + #endregion + + /// + /// Gets a value indicating whether the module is imported + /// + internal bool IsModuleImported + { + get + { + return this.isModuleImported; + } + } + + /// + /// Sets the AllModulesViewModel containing this + /// + /// the AllModulesViewModel containing this + internal void SetAllModules(AllModulesViewModel parentAllModules) + { + this.allModules = parentAllModules; + } + + /// + /// Sorts commands and optionally sets ModuleQualifyCommandName + /// + /// true to mark repeated commands with a flag that will produce a module qualified name in GetScript + internal void SortCommands(bool markRepeatedCmdlets) + { + this.commands.Sort(this.Compare); + + if (!markRepeatedCmdlets || this.commands.Count == 0) + { + return; + } + + CommandViewModel reference = this.commands[0]; + for (int i = 1; i < this.commands.Count; i++) + { + CommandViewModel command = this.commands[i]; + if (reference.Name.Equals(command.Name, StringComparison.OrdinalIgnoreCase)) + { + reference.ModuleQualifyCommandName = true; + command.ModuleQualifyCommandName = true; + } + else + { + reference = command; + } + } + } + + /// + /// According commandNameFilter to filter command,and added the filter commands into filteredCommands property + /// + /// current filter + internal void RefreshFilteredCommands(string filter) + { + this.filteredCommands.Clear(); + if (String.IsNullOrEmpty(filter)) + { + foreach (CommandViewModel command in this.Commands) + { + this.filteredCommands.Add(command); + } + + return; + } + + WildcardPattern filterPattern = null; + if (WildcardPattern.ContainsWildcardCharacters(filter)) + { + filterPattern = new WildcardPattern(filter, WildcardOptions.IgnoreCase); + } + + foreach (CommandViewModel command in this.Commands) + { + if (ModuleViewModel.Matches(filterPattern, command.Name, filter)) + { + this.filteredCommands.Add(command); + continue; + } + + if (filterPattern != null) + { + continue; + } + + string[] textSplit = filter.Split(' '); + if (textSplit.Length != 2) + { + continue; + } + + if (ModuleViewModel.Matches(filterPattern, command.Name, textSplit[0] + "-" + textSplit[1])) + { + this.filteredCommands.Add(command); + } + } + } + + /// + /// Callled in response to a GUI event that requires the command to be run + /// + internal void OnRunSelectedCommand() + { + EventHandler handler = this.RunSelectedCommand; + if (handler != null) + { + handler(this, new CommandEventArgs(this.SelectedCommand)); + } + } + + /// + /// Triggers the SelectedCommandNeedsHelp event + /// + /// event arguments + internal void OnSelectedCommandNeedsHelp(HelpNeededEventArgs e) + { + EventHandler handler = this.SelectedCommandNeedsHelp; + if (handler != null) + { + handler(this, e); + } + } + + /// + /// Triggers the SelectedCommandNeedsImportModule event + /// + internal void OnSelectedCommandNeedsImportModule() + { + EventHandler handler = this.SelectedCommandNeedsImportModule; + if (handler != null) + { + handler(this, new ImportModuleEventArgs(this.SelectedCommand.Name, this.SelectedCommand.ModuleName, this.Name)); + } + } + #region Private Method + + /// + /// Uses pattern matching if pattern is not null or calls MatchesEvenIfInPlural otherwise + /// + /// pattern corresponding to filter + /// command name string + /// filter string + /// true if coparisonText matches str or pattern + private static bool Matches(WildcardPattern filterPattern, string commandName, string filter) + { + if (filterPattern != null) + { + return filterPattern.IsMatch(commandName); + } + + return ModuleViewModel.MatchesEvenIfInPlural(commandName, filter); + } + + /// + /// Returns true if filter matches commandName, even when filter is in the plural + /// + /// command name string + /// filter string + /// return match result + private static bool MatchesEvenIfInPlural(string commandName, string filter) + { + if (commandName.IndexOf(filter, StringComparison.OrdinalIgnoreCase) != -1) + { + return true; + } + + if (filter.Length > 5 && filter.EndsWith("es", StringComparison.OrdinalIgnoreCase)) + { + filter = filter.Substring(0, filter.Length - 2); + return commandName.IndexOf(filter, StringComparison.OrdinalIgnoreCase) != -1; + } + + if (filter.Length > 4 && filter.EndsWith("s", StringComparison.OrdinalIgnoreCase)) + { + filter = filter.Substring(0, filter.Length - 1); + return commandName.IndexOf(filter, StringComparison.OrdinalIgnoreCase) != -1; + } + + return false; + } + + /// + /// Handles the HelpNeeded event in the selected command and triggers the SelectedCommandNeedsHelp event + /// + /// HelpNeeded event sender + /// HelpNeeded event argument + private void SelectedCommand_HelpNeeded(object sender, HelpNeededEventArgs e) + { + this.OnSelectedCommandNeedsHelp(e); + } + + /// + /// Handles the ImportModule event in the selected command and triggers the SelectedCommandNeedsImportModule event + /// + /// HelpNeeded event sender + /// HelpNeeded event argument + private void SelectedCommand_ImportModule(object sender, EventArgs e) + { + this.OnSelectedCommandNeedsImportModule(); + } + + /// + /// Called when the SelectedCommand property changes to update IsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues + /// + /// event sender + /// event arguments + private void SelectedCommand_PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (!e.PropertyName.Equals("SelectedParameterSetAllMandatoryParametersHaveValues")) + { + return; + } + + this.SetIsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues(); + } + + /// + /// Called to set IsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues when + /// SelectedParameterSetAllMandatoryParametersHaveValues changes in the SelectedCommand or + /// when the SelectedCommand changes + /// + private void SetIsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues() + { + this.IsThereASelectedImportedCommandWhereAllMandatoryParametersHaveValues = + this.selectedCommand != null && + this.selectedCommand.IsImported && + this.selectedCommand.SelectedParameterSetAllMandatoryParametersHaveValues; + } + + /// + /// Compare source commandmodule is equal like target commandmodule + /// + /// source commandmodule + /// target commandmodule + /// return compare result + private int Compare(CommandViewModel source, CommandViewModel target) + { + return String.Compare(source.Name, target.Name, StringComparison.OrdinalIgnoreCase); + } + #endregion + + /// + /// If property changed will be notify + /// + /// The changed property + private void OnNotifyPropertyChanged(string propertyName) + { + PropertyChangedEventHandler handler = this.PropertyChanged; + if (handler != null) + { + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterSetViewModel.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterSetViewModel.cs new file mode 100644 index 00000000000..40ed0a0029f --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterSetViewModel.cs @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; +using System.Management.Automation; +using System.Management.Automation.Language; +using System.Text; + +using Microsoft.PowerShell.Commands.ShowCommandExtension; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Contains information about a single ParameterSet inside a cmdlet. + /// + public class ParameterSetViewModel : INotifyPropertyChanged + { + /// + /// Field used for the Name parameter. + /// + private string name; + + /// + /// value indicating all mandatory parameters have values + /// + private bool allMandatoryParametersHaveValues; + + /// + /// Field used for the Parameters parameter. + /// + private List parameters; + + #region Construction and Destructor + + /// + /// Initializes a new instance of the ParameterSetViewModel class. + /// + /// The name of the parameterSet + /// The array parametes of the parameterSet + [SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "this type is internal, made public only for WPF Binding")] + public ParameterSetViewModel( + string name, + List parameters) + { + if (name == null) + { + throw new ArgumentNullException("name"); + } + + if (parameters == null) + { + throw new ArgumentNullException("parameters"); + } + + parameters.Sort(Compare); + + this.name = name; + this.parameters = parameters; + foreach (ParameterViewModel parameter in this.parameters) + { + if (!parameter.IsMandatory) + { + continue; + } + + parameter.PropertyChanged += new PropertyChangedEventHandler(this.MandatoryParameter_PropertyChanged); + } + + this.EvaluateAllMandatoryParametersHaveValues(); + } + #endregion + + #region INotifyPropertyChanged Members + + /// + /// PropertyChanged Event + /// + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + + #region Public Property + /// + /// Gets the ParameterSet Name + /// + public string Name + { + get { return this.name; } + } + + /// + /// Gets the Parameters of this parameterset + /// + public List Parameters + { + get { return this.parameters; } + } + + /// + /// Gets or sets a value indicating whether all mandatory parameters have values + /// + public bool AllMandatoryParametersHaveValues + { + get + { + return this.allMandatoryParametersHaveValues; + } + + set + { + if (this.allMandatoryParametersHaveValues != value) + { + this.allMandatoryParametersHaveValues = value; + this.OnNotifyPropertyChanged("AllMandatoryParametersHaveValues"); + } + } + } + #endregion + + #region Public Method + /// + /// Creates script according parameters of this parameterset + /// + /// Return script of this parameterset parameters + public string GetScript() + { + if (this.Parameters == null || this.Parameters.Count == 0) + { + return string.Empty; + } + + StringBuilder builder = new StringBuilder(); + foreach (ParameterViewModel parameter in this.Parameters) + { + if (parameter.Value == null) + { + continue; + } + + if (parameter.Parameter.ParameterType.IsSwitch) + { + if (((bool?)parameter.Value) == true) + { + builder.AppendFormat("-{0} ", parameter.Name); + } + + continue; + } + + string parameterValueString = parameter.Value.ToString(); + + if (parameterValueString.Length == 0) + { + continue; + } + + ShowCommandParameterType parameterType = parameter.Parameter.ParameterType; + + if (parameterType.IsEnum || parameterType.IsString || (parameterType.IsArray && parameterType.ElementType.IsString)) + { + parameterValueString = ParameterSetViewModel.GetDelimitedParameter(parameterValueString, "\"", "\""); + } + else if(parameterType.IsScriptBlock) + { + parameterValueString = ParameterSetViewModel.GetDelimitedParameter(parameterValueString, "{", "}"); + } + else + { + parameterValueString = ParameterSetViewModel.GetDelimitedParameter(parameterValueString, "(", ")"); + } + + builder.AppendFormat("-{0} {1} ", parameter.Name, parameterValueString); + } + + return builder.ToString().Trim(); + } + + /// + /// Gets the individual parameter count of this parameterset + /// + /// Return individual parameter count of this parameterset + public int GetIndividualParameterCount() + { + if (this.Parameters == null || this.Parameters.Count == 0) + { + return 0; + } + + int i = 0; + + foreach (ParameterViewModel p in this.Parameters) + { + if (p.IsInSharedParameterSet) + { + return i; + } + + i++; + } + + return i; + } + + #endregion + + #region Internal Method + + /// + /// Compare source parametermodel is equal like target parametermodel + /// + /// the source of parametermodel + /// the target of parametermodel + /// Return compare result + internal static int Compare(ParameterViewModel source, ParameterViewModel target) + { + if (source.Parameter.IsMandatory && !target.Parameter.IsMandatory) + { + return -1; + } + + if (!source.Parameter.IsMandatory && target.Parameter.IsMandatory) + { + return 1; + } + + return String.Compare(source.Parameter.Name, target.Parameter.Name); + } + + #endregion + + /// + /// Gets the delimited poarameter if it needs delimitation and is not delimited + /// + /// value needing delimitation + /// open delimitation + /// close delimitation + /// the delimited poarameter if it needs delimitation and is not delimited + private static string GetDelimitedParameter(string parameterValue, string openDelimiter, string closeDelimiter) + { + string parameterValueTrimmed = parameterValue.Trim(); + + if (parameterValueTrimmed.Length == 0) + { + return openDelimiter + parameterValue + closeDelimiter; + } + + char delimitationChar = ParameterSetViewModel.ParameterNeedsDelimitation(parameterValueTrimmed, openDelimiter.Length == 1 && openDelimiter[0] == '{'); + switch (delimitationChar) + { + case '1': + return openDelimiter + parameterValue + closeDelimiter; + case '\'': + return '\'' + parameterValue + '\''; + case '\"': + return '\"' + parameterValue + '\"'; + default: + return parameterValueTrimmed; + } + } + + /// + /// Returns '0' if the does not need delimitation, '1' if it does, and a quote character if it needs to be delimited with a quote + /// + /// parameter value to check + /// true if the parameter value should be a scriptblock + /// '0' if the parameter does not need delimitation, '1' if it needs, '\'' if it needs to be delimited with single quote and '\"' if it needs to be delimited with double quotes + private static char ParameterNeedsDelimitation(string parameterValue, bool requireScriptblock) + { + Token[] tokens; + ParseError[] errors; + ScriptBlockAst values = Parser.ParseInput("commandName -parameterName " + parameterValue, out tokens, out errors); + + if (values == null || values.EndBlock == null || values.EndBlock.Statements.Count == 0) + { + return '1'; + } + + PipelineAst pipeline = values.EndBlock.Statements[0] as PipelineAst; + if (pipeline == null || pipeline.PipelineElements.Count == 0) + { + return '1'; + } + + CommandAst commandAst = pipeline.PipelineElements[0] as CommandAst; + + if (commandAst == null || commandAst.CommandElements.Count == 0) + { + return '1'; + } + + // 3 is for CommandName, Parameter and its value + if (commandAst.CommandElements.Count != 3) + { + return '1'; + } + + if (requireScriptblock) + { + ScriptBlockExpressionAst scriptAst = commandAst.CommandElements[2] as ScriptBlockExpressionAst; + return scriptAst == null ? '1' : '0'; + } + + StringConstantExpressionAst stringValue = commandAst.CommandElements[2] as StringConstantExpressionAst; + if (stringValue != null) + { + if (errors.Length == 0) + { + return '0'; + } + + char stringTerminationChar; + + if (stringValue.StringConstantType == StringConstantType.BareWord) + { + stringTerminationChar = parameterValue[0]; + } + else if (stringValue.StringConstantType == StringConstantType.DoubleQuoted || stringValue.StringConstantType == StringConstantType.DoubleQuotedHereString) + { + stringTerminationChar = '\"'; + } + else + { + stringTerminationChar = '\''; + } + + char oppositeTerminationChar = stringTerminationChar == '\"' ? '\'' : '\"'; + + // If the string is not terminated, it should be delimited by the opposite string termination character + return oppositeTerminationChar; + } + + if (errors.Length != 0) + { + return '1'; + } + + return '0'; + } + + /// + /// Called to evaluate the value of AllMandatoryParametersHaveValues + /// + private void EvaluateAllMandatoryParametersHaveValues() + { + bool newCanRun = true; + foreach (ParameterViewModel parameter in this.parameters) + { + if (!parameter.IsMandatory) + { + continue; + } + + if (!parameter.HasValue) + { + newCanRun = false; + break; + } + } + + this.AllMandatoryParametersHaveValues = newCanRun; + } + + /// + /// If property changed will be notify + /// + /// The changed property + private void OnNotifyPropertyChanged(string propertyName) + { + PropertyChangedEventHandler handler = this.PropertyChanged; + if (handler != null) + { + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// Used to track changes to parameter values in order to verify the enabled state of buttons + /// + /// event arguments + /// event sender + private void MandatoryParameter_PropertyChanged(object sender, PropertyChangedEventArgs e) + { + if (!e.PropertyName.Equals("Value", StringComparison.Ordinal)) + { + return; + } + + this.EvaluateAllMandatoryParametersHaveValues(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterViewModel.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterViewModel.cs new file mode 100644 index 00000000000..e27c39f49db --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterViewModel.cs @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.ComponentModel; +using System.Globalization; +using System.Management.Automation; +using System.Text; + +using Microsoft.Management.UI.Internal; +using Microsoft.PowerShell.Commands.ShowCommandExtension; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Contains information about a single parameter inside a parameter set. + /// If a parameter with the same name belongs to two (or more) parameter sets, + /// there will be two (or more) ParameterViewModel objects for the parameters, + /// each one inside its own ParameterSetViewModel. + /// + public class ParameterViewModel : INotifyPropertyChanged + { + /// + /// ParameterMetadata contains information that is the same throughout parameter sets + /// like Name and Type. + /// Note: It also happens to contain a list of all ParameterSetMetadata for the parametersets + /// in this cmdlet, but this information is not used in this class since if a parameter is + /// in multiple parametersets, there will be a ParameterViewModel for each time the parameter + /// appears in a parameterset. + /// + private ShowCommandParameterInfo parameter; + + /// + /// value entered in the GUI for the parameter + /// + private object parameterValue; + + /// + /// Name of the parameter set this parameter is in + /// + private string parameterSetName; + + #region Construction and Destructor + /// + /// Initializes a new instance of the ParameterViewModel class. + /// + /// The parameter information for this parameter + /// the name of the parameter set this parameter is in + public ParameterViewModel(ShowCommandParameterInfo parameter, string parameterSetName) + { + if (parameter == null) + { + throw new ArgumentNullException("parameter"); + } + + if (parameterSetName == null) + { + throw new ArgumentNullException("parameterSetName"); + } + + this.parameter = parameter; + this.parameterSetName = parameterSetName; + + if (this.parameter.ParameterType.IsSwitch) + { + this.parameterValue = false; + } + else + { + this.parameterValue = String.Empty; + } + } + #endregion + + #region INotifyPropertyChanged Members + + /// + /// PropertyChanged Event + /// + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + + #region Properties + /// + /// Gets the ParameterMetadata that contains information that is the same throughout parameter sets + /// like Name and Type. + /// + public ShowCommandParameterInfo Parameter + { + get { return this.parameter; } + } + + /// + /// Gets or sets the value for this parameter from the GUI + /// + public object Value + { + get + { + return this.parameterValue; + } + + set + { + if (this.parameterValue != value) + { + this.parameterValue = value; + this.OnNotifyPropertyChanged("Value"); + } + } + } + + /// + /// Gets the parameter name + /// + public string Name + { + get { return this.Parameter.Name; } + } + + /// + /// Gets the name of the parameter set this parameter is in + /// + public string ParameterSetName + { + get { return this.parameterSetName; } + } + + /// + /// Gets a value indicating whether this parameter is in the shared parameterset + /// + public bool IsInSharedParameterSet + { + get { return CommandViewModel.IsSharedParameterSetName(this.parameterSetName); } + } + + /// + /// Gets Name with an extra suffix to indicate if the parameter is mandatory to serve + /// + public string NameTextLabel + { + get + { + return this.Parameter.IsMandatory ? + String.Format( + CultureInfo.CurrentUICulture, + ShowCommandResources.MandatoryNameLabelFormat, + this.Name, + ShowCommandResources.MandatoryLabelSegment) : + String.Format( + CultureInfo.CurrentUICulture, + ShowCommandResources.NameLabelFormat, + this.Name); + } + } + + /// + /// Gets Label in the case this parameter is used in a combo box + /// + public string NameCheckLabel + { + get + { + string returnValue = this.Parameter.Name; + if (this.Parameter.IsMandatory) + { + returnValue = string.Format(CultureInfo.CurrentUICulture, "{0}{1}", returnValue, ShowCommandResources.MandatoryLabelSegment); + } + + return returnValue; + } + } + + /// + /// Gets Tooltip string for the parameter + /// + public string ToolTip + { + get + { + return ParameterViewModel.EvaluateTooltip( + this.Parameter.ParameterType.FullName, + this.Parameter.Position, + this.Parameter.IsMandatory, + this.IsInSharedParameterSet, + this.Parameter.ValueFromPipeline); + } + } + + /// + /// Gets a value indicating whether the parameter is mandatory + /// + public bool IsMandatory + { + get { return this.Parameter.IsMandatory; } + } + + /// + /// Gets a value indicating whether the parameter has a value + /// + public bool HasValue + { + get + { + if (this.Value == null) + { + return false; + } + + if (this.Parameter.ParameterType.IsSwitch) + { + return ((bool?)this.Value) == true; + } + + return this.Value.ToString().Length != 0; + } + } + #endregion + + /// + /// Evaluates the tooltip based on the parameters + /// + /// parameter type name + /// parameter position + /// true if the parameter is mandatory + /// true if the parameter is shared by parameter sets + /// true if the parameter takes value from the pipeline + /// the tooltip based on the parameters + internal static string EvaluateTooltip(string typeName, int position, bool mandatory, bool shared, bool valueFromPipeline) + { + StringBuilder returnValue = new StringBuilder(String.Format( + CultureInfo.CurrentCulture, + ShowCommandResources.TypeFormat, + typeName)); + string newlineFormatString = Environment.NewLine + "{0}"; + + if (position >= 0) + { + string positionFormat = String.Format( + CultureInfo.CurrentCulture, + ShowCommandResources.PositionFormat, + position); + + returnValue.AppendFormat(CultureInfo.InvariantCulture, newlineFormatString, positionFormat); + } + + string optionalOrMandatory = mandatory ? ShowCommandResources.Mandatory : ShowCommandResources.Optional; + + returnValue.AppendFormat(CultureInfo.InvariantCulture, newlineFormatString, optionalOrMandatory); + + if (shared) + { + returnValue.AppendFormat(CultureInfo.InvariantCulture, newlineFormatString, ShowCommandResources.CommonToAllParameterSets); + } + + if (valueFromPipeline) + { + returnValue.AppendFormat(CultureInfo.InvariantCulture, newlineFormatString, ShowCommandResources.CanReceiveValueFromPipeline); + } + + return returnValue.ToString(); + } + + /// + /// If property changed will be notify + /// + /// The changed property + private void OnNotifyPropertyChanged(string propertyName) + { + PropertyChangedEventHandler handler = this.PropertyChanged; + if (handler != null) + { + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml new file mode 100644 index 00000000000..feb46a749b6 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml.cs new file mode 100644 index 00000000000..d6e51ce6368 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Windows; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Interaction logic for MultipleSelectionDialog.xaml + /// + public partial class MultipleSelectionDialog : Window + { + /// + /// Initializes a new instance of the MultipleSelectionDialog class. + /// + public MultipleSelectionDialog() + { + this.InitializeComponent(); + } + + /// + /// OK Click event function + /// + /// event sender + /// event arguments + private void ButtonOK_Click(object sender, RoutedEventArgs e) + { + this.DialogResult = true; + this.Close(); + } + + /// + /// Cancel Click event function + /// + /// event sender + /// event arguments + private void ButtonCancel_Click(object sender, RoutedEventArgs e) + { + this.DialogResult = false; + this.Close(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowAllModulesWindow.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowAllModulesWindow.xaml new file mode 100644 index 00000000000..c3bcd6a1a9f --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowAllModulesWindow.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs new file mode 100644 index 00000000000..68dd7ebd37e --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Windows; +using System.Windows.Input; + +using Microsoft.Management.UI.Internal; +using Microsoft.Management.UI.Internal.ShowCommand; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Interaction logic for CmdletGUI.xaml + /// + public partial class ShowAllModulesWindow : Window + { + + /// + /// private constants for ZoomLevel + /// + private double zoomLevel = 1.0; + + /// + /// Zoom Increments + /// + private const double ZOOM_INCREMENT = 0.2; + + /// + /// Max ZoomLevel + /// + private const double ZOOM_MAX = 3.0; + + /// + /// Min ZoomLevel + /// + private const double ZOOM_MIN = 0.5; + + + #region Construction and Destructor + + /// + /// Initializes a new instance of the ShowAllModulesWindow class. + /// + public ShowAllModulesWindow() + { + this.InitializeComponent(); + + if (this.AllModulesControl != null && this.AllModulesControl.ShowModuleControl != null) + { + this.AllModulesControl.ShowModuleControl.Owner = this; + } + + this.SizeChanged += new SizeChangedEventHandler(this.ShowAllModulesWindow_SizeChanged); + this.LocationChanged += new System.EventHandler(this.ShowAllModulesWindow_LocationChanged); + this.StateChanged += new System.EventHandler(this.ShowAllModulesWindow_StateChanged); + this.Loaded += new RoutedEventHandler(this.ShowAllModulesWindow_Loaded); + + RoutedCommand plusSettings = new RoutedCommand(); + KeyGestureConverter keyGestureConverter = new KeyGestureConverter(); + + try + { + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomIn1Shortcut)); + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomIn2Shortcut)); + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomIn3Shortcut)); + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomIn4Shortcut)); + CommandBindings.Add(new CommandBinding(plusSettings, ZoomEventHandlerPlus)); + } + catch (NotSupportedException) + { + //localized has a problematic string - going to default + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Add")); + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Plus")); + CommandBindings.Add(new CommandBinding(plusSettings, ZoomEventHandlerPlus)); + }; + + + RoutedCommand minusSettings = new RoutedCommand(); + try + { + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomOut1Shortcut)); + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomOut2Shortcut)); + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomOut3Shortcut)); + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomOut4Shortcut)); + + CommandBindings.Add(new CommandBinding(minusSettings, ZoomEventHandlerMinus)); + } + catch (NotSupportedException) + { + //localized has a problematic string - going to default + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Subtract")); + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Minus")); + CommandBindings.Add(new CommandBinding(minusSettings, ZoomEventHandlerMinus)); + } + + } + + /// + /// Saves the user settings + /// + /// event arguments + protected override void OnClosed(System.EventArgs e) + { + ShowCommandSettings.Default.Save(); + base.OnClosed(e); + } + + /// + /// Sets the focus on the CommandName control + /// + /// event sender + /// event arguments + private void ShowAllModulesWindow_Loaded(object sender, RoutedEventArgs e) + { + this.AllModulesControl.CommandName.Focus(); + } + + /// + /// Saves size changes in user settings + /// + /// event sender + /// event arguments + private void ShowAllModulesWindow_SizeChanged(object sender, SizeChangedEventArgs e) + { + ShowCommandSettings.Default.ShowCommandsWidth = this.Width; + ShowCommandSettings.Default.ShowCommandsHeight = this.Height; + } + + /// + /// Saves position changes in user settings + /// + /// event sender + /// event arguments + private void ShowAllModulesWindow_LocationChanged(object sender, System.EventArgs e) + { + ShowCommandSettings.Default.ShowCommandsTop = this.Top; + ShowCommandSettings.Default.ShowCommandsLeft = this.Left; + } + + /// + /// Updates the user setting with window state + /// + /// event sender + /// event arguments + private void ShowAllModulesWindow_StateChanged(object sender, System.EventArgs e) + { + ShowCommandSettings.Default.ShowCommandsWindowMaximized = this.WindowState == WindowState.Maximized; + } + + /// + /// Implements ZoomIn + /// + /// + /// + private void ZoomEventHandlerPlus(object sender, ExecutedRoutedEventArgs e) + { + AllModulesViewModel viewModel = this.DataContext as AllModulesViewModel; + if (viewModel == null) + { + return; + } + + if (this.zoomLevel == 0) + { + this.zoomLevel = 1; + } + + if (this.zoomLevel < ZOOM_MAX) + { + //ViewModel applies ZoomLevel after dividing it by 100, So multiply it by 100 and then later reset to normal by dividing for next zoom + this.zoomLevel = ((this.zoomLevel + ZOOM_INCREMENT) * 100); + viewModel.ZoomLevel = this.zoomLevel; + this.zoomLevel /= 100; + } + } + + /// + /// Implements ZoomOut + /// + /// + /// + private void ZoomEventHandlerMinus(object sender, ExecutedRoutedEventArgs e) + { + AllModulesViewModel viewModel = this.DataContext as AllModulesViewModel; + if (viewModel == null) + { + return; + } + + if (this.zoomLevel >= ZOOM_MIN) + { + //ViewModel applies ZoomLevel after dividing it by 100, So multiply it by 100 and then later reset to normal by dividing it for next zoom + this.zoomLevel = ((this.zoomLevel - ZOOM_INCREMENT) * 100); + viewModel.ZoomLevel = this.zoomLevel; + this.zoomLevel /= 100; + } + } + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowCommandWindow.xaml b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowCommandWindow.xaml new file mode 100644 index 00000000000..80bd706d253 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowCommandWindow.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowCommandWindow.xaml.cs b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowCommandWindow.xaml.cs new file mode 100644 index 00000000000..79025d536d4 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/ShowCommandWindow.xaml.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Windows; + +using Microsoft.Management.UI.Internal.ShowCommand; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Interaction logic for CmdletGUI.xaml + /// + public partial class ShowCommandWindow : Window + { + #region Construction and Destructor + + /// + /// Initializes a new instance of the ShowCommandWindow class. + /// + public ShowCommandWindow() + { + this.InitializeComponent(); + this.SizeChanged += new SizeChangedEventHandler(this.ShowCommandWindow_SizeChanged); + this.LocationChanged += new System.EventHandler(this.ShowCommandWindow_LocationChanged); + this.StateChanged += new System.EventHandler(this.ShowCommandWindow_StateChanged); + } + + /// + /// Saves the user settings + /// + /// event arguments + protected override void OnClosed(System.EventArgs e) + { + ShowCommandSettings.Default.Save(); + base.OnClosed(e); + } + + /// + /// Saves size changes in user settings + /// + /// event sender + /// event arguments + private void ShowCommandWindow_SizeChanged(object sender, SizeChangedEventArgs e) + { + ShowCommandSettings.Default.ShowOneCommandWidth = this.Width; + ShowCommandSettings.Default.ShowOneCommandHeight = this.Height; + } + + /// + /// Saves position changes in user settings + /// + /// event sender + /// event arguments + private void ShowCommandWindow_LocationChanged(object sender, System.EventArgs e) + { + ShowCommandSettings.Default.ShowOneCommandTop = this.Top; + ShowCommandSettings.Default.ShowOneCommandLeft = this.Left; + } + + /// + /// Updates the user setting with window state + /// + /// event sender + /// event arguments + private void ShowCommandWindow_StateChanged(object sender, System.EventArgs e) + { + ShowCommandSettings.Default.ShowOneCommandWindowMaximized = this.WindowState == WindowState.Maximized; + } + #endregion + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/app.config b/src/Microsoft.PowerShell.GraphicalHost/app.config new file mode 100644 index 00000000000..42747cf7b50 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/app.config @@ -0,0 +1,99 @@ + + + + +
+
+ + + + + + -1 + + + -1 + + + -1 + + + -1 + + + -1 + + + -1 + + + -1 + + + -1 + + + False + + + False + + + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + True + + + False + + + False + + + -1 + + + -1 + + + False + + + 100 + + + 500 + + + 700 + + + True + + + + \ No newline at end of file diff --git a/src/Microsoft.PowerShell.GraphicalHost/commandHelpers/HelpWindowHelper.cs b/src/Microsoft.PowerShell.GraphicalHost/commandHelpers/HelpWindowHelper.cs new file mode 100644 index 00000000000..70c4f003d15 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/commandHelpers/HelpWindowHelper.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Management.Automation; +using System.Threading; +using System.Windows; + +using Microsoft.Management.UI; +using Microsoft.PowerShell.Commands.ShowCommandInternal; + +namespace Microsoft.PowerShell.Commands.Internal +{ + /// + /// Implements thw WPF window part of the the ShowWindow option of get-help + /// + internal static class HelpWindowHelper + { + /// + /// Shows the help window + /// + /// object with help information + /// cmdlet calling this method + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called from methods called using reflection")] + private static void ShowHelpWindow(PSObject helpObj, PSCmdlet cmdlet) + { + Window ownerWindow = ShowCommandHelper.GetHostWindow(cmdlet); + if (ownerWindow != null) + { + ownerWindow.Dispatcher.Invoke( + new SendOrPostCallback( + delegate(object ignored) + { + HelpWindow helpWindow = new HelpWindow(helpObj); + helpWindow.Owner = ownerWindow; + helpWindow.Show(); + + helpWindow.Closed += new EventHandler(delegate(object sender, EventArgs e) { ownerWindow.Focus(); }); + }), + String.Empty); + return; + } + + Thread guiThread = new Thread( + (ThreadStart)delegate + { + HelpWindow helpWindow = new HelpWindow(helpObj); + helpWindow.ShowDialog(); + }); + guiThread.SetApartmentState(ApartmentState.STA); + guiThread.Start(); + } + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/commandHelpers/OutGridView.cs b/src/Microsoft.PowerShell.GraphicalHost/commandHelpers/OutGridView.cs new file mode 100644 index 00000000000..d9f89cf8622 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/commandHelpers/OutGridView.cs @@ -0,0 +1,599 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics.CodeAnalysis; +using System.Management.Automation; +using System.Threading; +using System.Windows; +using System.Windows.Automation; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; + +namespace Microsoft.Management.UI.Internal +{ + /// + /// OutGridViewWindow definition for PowerShell command out-gridview. + /// + internal class OutGridViewWindow + { + #region private Fields + + /// + /// Zoom Increments + /// + private const double ZOOM_INCREMENT = 0.2; + + /// + /// Max ZoomLevel + /// + private const double ZOOM_MAX = 3.0; + + /// + /// Min ZoomLevel + /// + private const double ZOOM_MIN = 0.5; + + /// + /// Window for gridView. + /// + private Window gridViewWindow; + + /// + /// Local ManagementList. + /// + private ManagementList managementList; + + /// + /// A collection of PSObjects to be data bound to the local Management List. + /// + private ObservableCollection listItems; + + /// + /// Event used for the thread gridViewWindows signaling main thread after Windows loaded + /// + private AutoResetEvent gridViewWindowLoaded; + + + /// Is used to store any Management list calls exceptions. + private Exception exception = null; + + /// + /// Is used to block thread of the pipeline. + /// + private AutoResetEvent closedEvent; + + /// + /// OK Button's content. + /// + private static readonly string OKButtonContent = XamlLocalizableResources.OutGridView_Button_OK; + + /// + /// Cancel Button's content. + /// + private static readonly string CancelButtonContent = XamlLocalizableResources.OutGridView_Button_Cancel; + + /// + /// Used to store selected items in the ok processing + /// + private List selectedItems; + + /// + /// The GUI thread of Out-GridView + /// + private Thread guiThread; + + /// + /// private constants for ZoomLevel + /// + private double zoomLevel = 1.0; + + + #endregion private Fields + + #region internal Constructors + + /// + /// Constructor for OutGridView. + /// + internal OutGridViewWindow() + { + // Initialize the data source collection. + this.listItems = new ObservableCollection(); + } + + #endregion internal Constructors + + #region private delegates + /// + /// ThreadDelegate definition. + /// + /// Start GridView Window delegate. + private delegate void ThreadDelegate(object arg); + + #endregion private delegates + + #region Private method that are intended to be called by the Out-GridView cmdlet. + + /// + /// Start a new thread as STA for gridView Window. + /// + /// commands of the PowerShell. + /// selection mode of the list + /// closedEvent + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "The method is called using reflection.")] + private void StartWindow(string invocation, string outputModeOptions, AutoResetEvent closedEvent) + { + this.closedEvent = closedEvent; + this.gridViewWindowLoaded = new AutoResetEvent(false); + + ParameterizedThreadStart threadStart = new ParameterizedThreadStart( + new ThreadDelegate(delegate + { + try + { + this.gridViewWindow = new Window(); + this.managementList = CreateManagementList(outputModeOptions); + this.gridViewWindow.Loaded += new RoutedEventHandler(this.GridViewWindowLoaded); + this.gridViewWindow.Content = CreateMainGrid(outputModeOptions); + this.gridViewWindow.Title = invocation; + this.gridViewWindow.Closed += new EventHandler(this.GridViewWindowClosed); + + RoutedCommand plusSettings = new RoutedCommand(); + KeyGestureConverter keyGestureConverter = new KeyGestureConverter(); + + try + { + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomIn1Shortcut)); + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomIn2Shortcut)); + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomIn3Shortcut)); + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomIn4Shortcut)); + this.gridViewWindow.CommandBindings.Add(new CommandBinding(plusSettings, ZoomEventHandlerPlus)); + } + catch (NotSupportedException) + { + //localized has a problematic string - going to default + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Add")); + plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Plus")); + this.gridViewWindow.CommandBindings.Add(new CommandBinding(plusSettings, ZoomEventHandlerPlus)); + }; + + RoutedCommand minusSettings = new RoutedCommand(); + try + { + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomOut1Shortcut)); + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomOut2Shortcut)); + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomOut3Shortcut)); + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString(UICultureResources.ZoomOut4Shortcut)); + + this.gridViewWindow.CommandBindings.Add(new CommandBinding(minusSettings, ZoomEventHandlerMinus)); + } + catch (NotSupportedException) + { + //localized has a problematic string - going to default + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Subtract")); + minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Minus")); + this.gridViewWindow.CommandBindings.Add(new CommandBinding(minusSettings, ZoomEventHandlerMinus)); + } + + this.gridViewWindow.ShowDialog(); + } + catch (Exception e) + { + // Store the exception in a local variable that will be checked later. + if (e.InnerException != null) + { + this.exception = e.InnerException; + } + else + { + this.exception = e; + } + } + })); + + guiThread = new Thread(threadStart); + guiThread.SetApartmentState(ApartmentState.STA); + + guiThread.Start(); + } + + /// + /// Implements ZoomIn + /// + /// + /// + private void ZoomEventHandlerPlus(object sender, ExecutedRoutedEventArgs e) + { + if (this.zoomLevel == 0) + { + this.zoomLevel = 1; + } + if (this.zoomLevel < ZOOM_MAX) + { + this.zoomLevel = this.zoomLevel + ZOOM_INCREMENT; + Grid g = this.gridViewWindow.Content as Grid; + if (g != null) + { + g.LayoutTransform = new ScaleTransform(this.zoomLevel, this.zoomLevel, 0, 0); + } + } + } + + /// + /// Implements ZoomOut + /// + /// + /// + private void ZoomEventHandlerMinus(object sender, ExecutedRoutedEventArgs e) + { + if (this.zoomLevel >= ZOOM_MIN) + { + this.zoomLevel = this.zoomLevel - ZOOM_INCREMENT; + Grid g = this.gridViewWindow.Content as Grid; + if (g != null) + { + g.LayoutTransform = new ScaleTransform(this.zoomLevel, this.zoomLevel, 0, 0); + } + } + } + + /// + /// Creates a new ManagementList. + /// + /// Output mode of the out-gridview + /// A new ManagementList + private ManagementList CreateManagementList(string outputMode) + { + ManagementList newList = new ManagementList(); + + newList.ViewSaverUserActionState = UserActionState.Hidden; + newList.ViewManagerUserActionState = UserActionState.Hidden; + newList.List.VerticalAlignment = VerticalAlignment.Stretch; + newList.List.SetValue(Grid.RowProperty, 0); + newList.List.SelectionMode = (outputMode == "Single") ? SelectionMode.Single : SelectionMode.Extended; + + return newList; + } + + /// + /// Creates a new main grid for window. + /// + /// Output mode of the out-gridview + /// A new mainGrid + private Grid CreateMainGrid(string outputMode) + { + Grid mainGrid = new Grid(); + mainGrid.RowDefinitions.Add(new RowDefinition()); + mainGrid.RowDefinitions[0].Height = new GridLength(1, GridUnitType.Star); + mainGrid.Children.Add(managementList); + + if (outputMode == "None") + { + return mainGrid; + } + + // OK and Cancel button should only be displayed if OutputMode is not None. + mainGrid.RowDefinitions.Add(new RowDefinition()); + mainGrid.RowDefinitions[1].Height = GridLength.Auto; + mainGrid.Children.Add(CreateButtonGrid()); + + return mainGrid; + } + + /// + /// Creates a OK button. + /// + /// A new buttonGrid + private Grid CreateButtonGrid() + { + Grid buttonGrid = new Grid(); + + //// This will allow OK and Cancel to have the same width + buttonGrid.SetValue(Grid.IsSharedSizeScopeProperty, true); + buttonGrid.ColumnDefinitions.Add(new ColumnDefinition()); + buttonGrid.ColumnDefinitions.Add(new ColumnDefinition()); + buttonGrid.ColumnDefinitions[0].Width = GridLength.Auto; + buttonGrid.ColumnDefinitions[0].SharedSizeGroup = "okCancel"; + buttonGrid.ColumnDefinitions[1].Width = GridLength.Auto; + buttonGrid.ColumnDefinitions[1].SharedSizeGroup = "okCancel"; + buttonGrid.HorizontalAlignment = HorizontalAlignment.Right; + buttonGrid.SetValue(Grid.RowProperty, 1); + + //// This will add OK and Cancel button to buttonGrid. + buttonGrid.Children.Add(CreateOKButton()); + buttonGrid.Children.Add(CreateCancelButton()); + + return buttonGrid; + } + + /// + /// Creates a OK button. + /// + /// A new OK button + private Button CreateOKButton() + { + Button ok = new Button(); + ok.Content = OKButtonContent; + ok.Margin = new Thickness(5); + ok.Padding = new Thickness(2); + ok.SetValue(Grid.ColumnProperty, 0); + ok.IsDefault = true; + ok.SetValue(AutomationProperties.AutomationIdProperty, "OGVOK"); + ok.Click += new RoutedEventHandler(OK_Click); + return ok; + } + + /// + /// Creates a Cancel button. + /// + /// A new Cancel button + private Button CreateCancelButton() + { + Button cancel = new Button(); + cancel.Content = CancelButtonContent; + cancel.Margin = new Thickness(5); + cancel.Padding = new Thickness(2); + cancel.SetValue(Grid.ColumnProperty, 1); + cancel.IsCancel = true; + cancel.SetValue(AutomationProperties.AutomationIdProperty, "OGVCancel"); + cancel.Click += new RoutedEventHandler(Cancel_Click); + return cancel; + } + + /// + /// Store the selected items for use in EndProcessing + /// + /// event sender + /// event arguments + private void OK_Click(object sender, RoutedEventArgs e) + { + if (this.managementList.List.SelectedItems.Count != 0) + { + this.selectedItems = new List(); + foreach(PSObject obj in this.managementList.List.SelectedItems) + { + this.selectedItems.Add(obj); + } + } + + this.gridViewWindow.Close(); + } + + /// + /// Closes the window + /// + /// event sender + /// event arguments + private void Cancel_Click(object sender, RoutedEventArgs e) + { + this.gridViewWindow.Close(); + } + + /// + /// Gets selected items from List. + /// + /// Selected items of the list + private List SelectedItems() + { + return this.selectedItems; + } + + /// + /// Closes the window + /// + public void CloseWindow() + { + this.gridViewWindow.Dispatcher.Invoke(new ThreadStart(delegate { this.gridViewWindow.Close(); })); + } + + /// + /// Add column definitions to the underlying management list. + /// + /// An array of property names to add. + /// An array of display names to add. + /// An array of types to add. + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "The method is called using reflection.")] + private void AddColumns(string[] propertyNames, string[] displayNames, Type[] types) + { + // Wait for the gridViewWindow thread to signal that loading of Window is done + if (this.gridViewWindowLoaded != null) + { + if(!this.gridViewWindowLoaded.WaitOne(5000)) + { + throw new Exception("The window didn't open in time"); + } + + this.gridViewWindowLoaded = null; + } + + this.managementList.Dispatcher.Invoke( + System.Windows.Threading.DispatcherPriority.Normal, + new Action( + delegate() + { + // Pick the length of the shortest incoming arrays. Normally all incoming arrays should be of the same length. + int length = propertyNames.Length; + if (length > displayNames.Length) + { + length = displayNames.Length; + } + + if (length > types.Length) + { + length = types.Length; + } + + try + { + // Clear all columns in case the view is changed. + this.managementList.List.Columns.Clear(); + + // Clear column filter rules. + this.managementList.AddFilterRulePicker.ColumnFilterRules.Clear(); + + // Add columns with provided names and Types. + for (int i = 0; i < propertyNames.Length; ++i) + { + DataTemplate dataTemplate; + bool haveTemplate = this.managementList.FilterRulePanel.TryGetContentTemplate(types[i], out dataTemplate); + InnerListColumn column = null; + + if(haveTemplate) + { + column = new InnerListColumn(new UIPropertyGroupDescription(propertyNames[i], displayNames[i], types[i])); + } + else + { + column = new InnerListColumn(new UIPropertyGroupDescription(propertyNames[i], displayNames[i], typeof(string))); + } + this.managementList.AddColumn(column); + } + + this.managementList.List.SetColumnHeaderActions(); + + if(this.managementList.List.ItemsSource == null) + { + // Setting ItemsSource implicitly regenerates all columns. + this.managementList.List.ItemsSource = this.listItems; + } + + // Set focus on ListView + this.managementList.List.SelectedIndex = 0; + this.managementList.List.Focus(); + } + catch (Exception e) + { + // Store the exception in a local variable that will be checked later. + if(e.InnerException != null) + { + this.exception = e.InnerException; + } + else + { + this.exception = e; + } + } + })); + } + + /// + /// Add an item to ObservableCollection. + /// + /// PSObject of comlet data. + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "The method is called using reflection.")] + private void AddItem(PSObject value) + { + if (this.GetWindowClosedStatus()) + { + return; + } + + this.managementList.Dispatcher.BeginInvoke( + System.Windows.Threading.DispatcherPriority.Normal, + new Action( + delegate() + { + try + { + this.listItems.Add(value); + } + catch (Exception e) + { + // Store the exception in a local variable that will be checked later. + if(e.InnerException != null) + { + this.exception = e.InnerException; + } + else + { + this.exception = e; + } + } + })); + } + + /// + /// Returns the state of GridView Window. + /// + /// The status of GridView Window close or not. + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "The method is called using reflection.")] + private bool GetWindowClosedStatus() + { + if (this.closedEvent == null) + { + return false; + } + + return this.closedEvent.WaitOne(0); + } + + /// + /// Returns any exception that has been thrown by previous method calls. + /// + /// The thrown and caught exception. It returns null if no exceptions were thrown by any previous method calls. + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "The method is called using reflection.")] + private Exception GetLastException() + { + Exception local = this.exception; + + if(local != null) + { + // Clear the caught exception. + this.exception = null; + return local; + } + + return this.exception; + } + + #endregion Private method that are intended to be called by the Out-GridView cmdlet. + + #region Private methods + + /// + /// GridView Window is closing callback process. + /// + /// The sender object. + /// Event Args. + private void GridViewWindowClosed(object sender, EventArgs e) + { + if (this.closedEvent != null && !this.closedEvent.SafeWaitHandle.IsClosed) + { + try + { + this.closedEvent.Set(); + } + catch(ObjectDisposedException) + { + // we tried to avoid this exception with "&& !this.closedEvent.SafeWaitHandle.IsClosed" + // but since this runs in a different thread the if condition could be evaluated and after that + // the handle disposed + } + } + } + + /// + /// Set loaded as true when this method invoked. + /// + /// The sender object. + /// RoutedEvent Args. + private void GridViewWindowLoaded(object sender, RoutedEventArgs e) + { + // signal the main thread + this.gridViewWindowLoaded.Set(); + + // Make gridview window as active window + this.gridViewWindow.Activate(); + + // Set up AutomationId and Name + AutomationProperties.SetName(this.gridViewWindow, GraphicalHostResources.OutGridViewWindowObjectName); + AutomationProperties.SetAutomationId(this.gridViewWindow, "OutGridViewWindow"); + } + + #endregion Private methods + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/commandHelpers/ShowCommandHelper.cs b/src/Microsoft.PowerShell.GraphicalHost/commandHelpers/ShowCommandHelper.cs new file mode 100644 index 00000000000..88752da8766 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/commandHelpers/ShowCommandHelper.cs @@ -0,0 +1,1304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Management.Automation; +using System.Reflection; +using System.Threading; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Threading; + +using Microsoft.Management.UI; +using Microsoft.Management.UI.Internal; +using Microsoft.Management.UI.Internal.ShowCommand; +using Microsoft.PowerShell.Commands.ShowCommandExtension; + +namespace Microsoft.PowerShell.Commands.ShowCommandInternal +{ + /// + /// Implements thw WPF window part of the show-command cmdlet + /// + internal class ShowCommandHelper : IDisposable + { + #region fields + + internal const string CommandTypeSegment = " -CommandType Cmdlet, Function, Script, ExternalScript, Workflow"; + + /// + /// Method that will return the dialog from ShowAllModulesWindow or ShowCommandWindow. + /// This is necessary because the PlainInvokeAndShowDialog thread starter cannot receive parameters + /// + private DispatcherOperationCallback methodThatReturnsDialog; + + /// + /// Event set when the window is closed + /// + private AutoResetEvent windowClosed = new AutoResetEvent(false); + + /// + /// Event set when help is needed + /// + private AutoResetEvent helpNeeded = new AutoResetEvent(false); + + /// + /// Event set when it is necessary to import a module + /// + private AutoResetEvent importModuleNeeded = new AutoResetEvent(false); + + /// + /// Event set when the window is loaded + /// + private AutoResetEvent windowLoaded = new AutoResetEvent(false); + + /// + /// String with the command that needs help set when helpNeeded is set + /// + private string commandNeedingHelp; + + /// + /// String with the command name that needs to import a module + /// + private string commandNeedingImportModule; + + /// + /// String with the module name that needs to be imported + /// + private string parentModuleNeedingImportModule; + + /// + /// String with the selected module at the time a module needs to be imported + /// + private string selectedModuleNeedingImportModule; + + /// + /// Keeps the window for the implementation of CloseWindow + /// + private Window window; + + /// + /// host window, if any + /// + private Window hostWindow; + + /// + /// ViewModel when showing all modules + /// + private AllModulesViewModel allModulesViewModel; + + /// + /// ViewModel when showing a single command + /// + private CommandViewModel commandViewModel; + + /// + /// true when the window is closed with cancel + /// + private bool dialogCanceled = true; + #endregion fields + + #region GetSerializedCommand script + + private const string ScriptGetSerializedCommand = @" +Function PSGetSerializedShowCommandInfo +{ + Function GetParameterType + { + param ( + [Type] $parameterType) + + $returnParameterType = new-object PSObject + $returnParameterType | Add-Member -MemberType NoteProperty -Name ""FullName"" -Value $parameterType.FullName + $returnParameterType | Add-Member -MemberType NoteProperty -Name ""IsEnum"" -Value $parameterType.IsEnum + $returnParameterType | Add-Member -MemberType NoteProperty -Name ""IsArray"" -Value $parameterType.IsArray + + if ($parameterType.IsEnum) + { + $enumValues = [System.Enum]::GetValues($parameterType) + } + else + { + $enumValues = [string[]] @() + } + $returnParameterType | Add-Member -MemberType NoteProperty -Name ""EnumValues"" -Value $enumValues + + if ($parameterType.IsArray) + { + $hasFlagAttribute = ($parameterType.GetCustomAttributes([System.FlagsAttribute], $true).Length -gt 0) + + # Recurse into array elements. + $elementType = GetParameterType($parameterType.GetElementType()) + } + else + { + $hasFlagAttribute = $false + $elementType = $null + } + $returnParameterType | Add-Member -MemberType NoteProperty -Name ""HasFlagAttribute"" -Value $hasFlagAttribute + $returnParameterType | Add-Member -MemberType NoteProperty -Name ""ElementType"" -Value $elementType + + + if (!($parameterType.IsEnum) -and !($parameterType.IsArray)) + { + $implementsDictionary = [System.Collections.IDictionary].IsAssignableFrom($parameterType) + } + else + { + $implementsDictionary = $false + } + $returnParameterType | Add-Member -MemberType NoteProperty -Name ""ImplementsDictionary"" -Value $implementsDictionary + + return $returnParameterType + } + + Function GetParameterInfo + { + param ( + $parameters) + + [PSObject[]] $parameterInfos = @() + + foreach ($parameter in $parameters) + { + $parameterInfo = new-object PSObject + $parameterInfo | Add-Member -MemberType NoteProperty -Name ""Name"" -Value $parameter.Name + $parameterInfo | Add-Member -MemberType NoteProperty -Name ""IsMandatory"" -Value $parameter.IsMandatory + $parameterInfo | Add-Member -MemberType NoteProperty -Name ""ValueFromPipeline"" -Value $parameter.ValueFromPipeline + $parameterInfo | Add-Member -MemberType NoteProperty -Name ""Position"" -Value $parameter.Position + $parameterInfo | Add-Member -MemberType NoteProperty -Name ""ParameterType"" -Value (GetParameterType($parameter.ParameterType)) + + $hasParameterSet = $false + [string[]] $validValues = @() + if ($PSVersionTable.PSVersion.Major -gt 2) + { + $validateSetAttributes = $parameter.Attributes | Where { + [ValidateSet].IsAssignableFrom($_.GetType()) + } + if (($validateSetAttributes -ne $null) -and ($validateSetAttributes.Count -gt 0)) + { + $hasParameterSet = $true + $validValues = $validateSetAttributes[0].ValidValues + } + } + $parameterInfo | Add-Member -MemberType NoteProperty -Name ""HasParameterSet"" -Value $hasParameterSet + $parameterInfo | Add-Member -MemberType NoteProperty -Name ""ValidParamSetValues"" -Value $validValues + + $parameterInfos += $parameterInfo + } + + return (,$parameterInfos) + } + + Function GetParameterSets + { + param ( + [System.Management.Automation.CommandInfo] $cmdInfo + ) + + $parameterSets = $null + try + { + $parameterSets = $cmdInfo.ParameterSets + } + catch [System.InvalidOperationException] { } + catch [System.Management.Automation.PSNotSupportedException] { } + catch [System.Management.Automation.PSNotImplementedException] { } + + if (($parameterSets -eq $null) -or ($parameterSets.Count -eq 0)) + { + return (,@()) + } + + [PSObject[]] $returnParameterSets = @() + + foreach ($parameterSet in $parameterSets) + { + $parameterSetInfo = new-object PSObject + $parameterSetInfo | Add-Member -MemberType NoteProperty -Name ""Name"" -Value $parameterSet.Name + $parameterSetInfo | Add-Member -MemberType NoteProperty -Name ""IsDefault"" -Value $parameterSet.IsDefault + $parameterSetInfo | Add-Member -MemberType NoteProperty -Name ""Parameters"" -Value (GetParameterInfo($parameterSet.Parameters)) + + $returnParameterSets += $parameterSetInfo + } + + return (,$returnParameterSets) + } + + Function GetModuleInfo + { + param ( + [System.Management.Automation.CommandInfo] $cmdInfo + ) + + if ($cmdInfo.ModuleName -ne $null) + { + $moduleName = $cmdInfo.ModuleName + } + else + { + $moduleName = """" + } + + $moduleInfo = new-object PSObject + $moduleInfo | Add-Member -MemberType NoteProperty -Name ""Name"" -Value $moduleName + + return $moduleInfo + } + + Function ConvertToShowCommandInfo + { + param ( + [System.Management.Automation.CommandInfo] $cmdInfo + ) + + $showCommandInfo = new-object PSObject + $showCommandInfo | Add-Member -MemberType NoteProperty -Name ""Name"" -Value $cmdInfo.Name + $showCommandInfo | Add-Member -MemberType NoteProperty -Name ""ModuleName"" -Value $cmdInfo.ModuleName + $showCommandInfo | Add-Member -MemberType NoteProperty -Name ""Module"" -Value (GetModuleInfo($cmdInfo)) + $showCommandInfo | Add-Member -MemberType NoteProperty -Name ""CommandType"" -Value $cmdInfo.CommandType + $showCommandInfo | Add-Member -MemberType NoteProperty -Name ""Definition"" -Value $cmdInfo.Definition + $showCommandInfo | Add-Member -MemberType NoteProperty -Name ""ParameterSets"" -Value (GetParameterSets($cmdInfo)) + + return $showCommandInfo + } + + $commandList = @(""Cmdlet"", ""Function"", ""Script"", ""ExternalScript"") + if ($PSVersionTable.PSVersion.Major -gt 2) + { + $commandList += ""Workflow"" + } + + foreach ($command in @(Get-Command -CommandType $commandList)) + { + Write-Output (ConvertToShowCommandInfo($command)) + } +}"; + + #endregion + + #region constructor and destructor + /// + /// Prevents a default instance of the ShowCommandHelper class from being created + /// + private ShowCommandHelper() + { + } + + /// + /// Finalizes an instance of the ShowCommandHelper class + /// + ~ShowCommandHelper() + { + this.Dispose(false); + } + #endregion constructor and destructor + + #region properties called using reflection + /// + /// Gets the Screen Width + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private static double ScreenWidth + { + get + { + return System.Windows.SystemParameters.PrimaryScreenWidth; + } + } + + /// + /// Gets the Screen Height + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private static double ScreenHeight + { + get + { + return System.Windows.SystemParameters.PrimaryScreenHeight; + } + } + + /// + /// Gets the event set when the show-command window is closed + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private AutoResetEvent WindowClosed + { + get + { + return this.windowClosed; + } + } + + /// + /// Gets the event set when help is needed for a command + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private AutoResetEvent HelpNeeded + { + get + { + return this.helpNeeded; + } + } + + /// + /// Gets the event set when it is necessary to import a module + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private AutoResetEvent ImportModuleNeeded + { + get + { + return this.importModuleNeeded; + } + } + + /// + /// Gets the event set when the window is loaded + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private AutoResetEvent WindowLoaded + { + get + { + return this.windowLoaded; + } + } + + /// + /// Gets the command needing help when HelpNeeded is set + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private string CommandNeedingHelp + { + get + { + return this.commandNeedingHelp; + } + } + + /// + /// Gets the module we want to import + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private string ParentModuleNeedingImportModule + { + get + { + return this.parentModuleNeedingImportModule; + } + } + + /// + /// Gets a value indicating whether there is a host window + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private bool HasHostWindow + { + get + { + return this.hostWindow != null; + } + } + #endregion properties called using reflection + + #region public Dispose + /// + /// Dispose method in IDisposeable + /// + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); + } + #endregion public Dispose + + #region internal static methods called using reflection from show-command + /// + /// Sets the text in the clipboard + /// + /// text to set the clipboard to + internal static void SetClipboardText(string text) + { + try + { + Clipboard.SetText(text); + } + catch (System.Runtime.InteropServices.COMException) + { + // This is the recommended way to set clipboard text + System.Threading.Thread.Sleep(0); + try + { + Clipboard.SetText(text); + } + catch (System.Runtime.InteropServices.COMException) + { + } + } + } + + /// + /// Gets the command to be run to get commands and imported modules + /// + /// Boolean flag determining whether Show-Command is queried in the local or remote runspace scenario + /// Boolean flag to indicate that it is the second attempt to query Show-Command data + /// the command to be run to get commands and imported modules + internal static string GetShowAllModulesCommand(bool isRemoteRunspace = false, bool isFirstChance = true) + { + string scriptBase; + + if (isRemoteRunspace) + { + if (isFirstChance) + { + // Return command to run. + scriptBase = "@(Get-Command " + ShowCommandHelper.CommandTypeSegment + @" -ShowCommandInfo)"; + } + else + { + // Return script to run. + scriptBase = GetSerializedCommandScript(); + } + } + else + { + scriptBase = "@(Get-Command " + ShowCommandHelper.CommandTypeSegment + ")"; + } + + + scriptBase += ShowCommandHelper.GetGetModuleSuffix(); + return scriptBase; + } + + /// + /// Retrieves the script for Get-SerializedCommand from local machine + /// + /// String representation of the script for Get-SerializedCommand + private static string GetSerializedCommandScript() + { + return string.Format(CultureInfo.InvariantCulture, "@({0};{1};{2})", + ScriptGetSerializedCommand, + @"PSGetSerializedShowCommandInfo", + @"Remove-Item -Path 'function:\PSGetSerializedShowCommandInfo' -Force"); + } + + + /// + /// Gets the command to be run to in order to import a module and refresh the command data + /// + /// module we want to import + /// Boolean flag determining whether Show-Command is queried in the local or remote runspace scenario + /// Boolean flag to indicate that it is the second attempt to query Show-Command data + /// the command to be run to in order to import a module and refresh the command data + internal static string GetImportModuleCommand(string module, bool isRemoteRunspace = false, bool isFirstChance = true) + { + string scriptBase = "Import-Module " + ShowCommandHelper.SingleQuote(module); + + if (isRemoteRunspace) + { + if (isFirstChance) + { + scriptBase += ";@(Get-Command " + ShowCommandHelper.CommandTypeSegment + @" -ShowCommandInfo )"; + } + else + { + scriptBase += GetSerializedCommandScript(); + } + } + else + { + scriptBase += ";@(Get-Command " + ShowCommandHelper.CommandTypeSegment + ")"; + } + + scriptBase += ShowCommandHelper.GetGetModuleSuffix(); + return scriptBase; + } + + /// + /// gets the command to be run in order to show help for a command + /// + /// command we want to get help from + /// the command to be run in order to show help for a command + internal static string GetHelpCommand(string command) + { + return "Get-Help " + ShowCommandHelper.SingleQuote(command); + } + + /// + /// Constructs a dictionary of imported modules based on the module names + /// + /// the imported modules + /// a dictionary of imported modules based on the module names + internal static Dictionary GetImportedModulesDictionary(object[] moduleObjects) + { + Dictionary returnValue = new Dictionary(StringComparer.OrdinalIgnoreCase); + foreach (PSObject rawModule in moduleObjects) + { + ShowCommandModuleInfo wrappedModule = null; + PSModuleInfo module = rawModule.BaseObject as PSModuleInfo; + if (module != null) + { + wrappedModule = new ShowCommandModuleInfo(module); + } + else + { + wrappedModule = new ShowCommandModuleInfo(rawModule); + } + + // It is probably an issue somewhere else that a module would show up twice in the list, but we want to avoid + // throwing an exception regarding that in returnValue.Add + if(!returnValue.ContainsKey(wrappedModule.Name)) + { + returnValue.Add(wrappedModule.Name, wrappedModule); + } + } + + return returnValue; + } + + /// + /// Constructs a list of commands out of + /// + /// the results of a get-command command + /// a list of commands out of + internal static List GetCommandList(object[] commandObjects) + { + List returnValue = new List(); + foreach (PSObject rawCommand in commandObjects) + { + CommandInfo command = rawCommand.BaseObject as CommandInfo; + if(command != null) + { + returnValue.Add(new ShowCommandCommandInfo(command)); + } + else + { + PSObject obj = rawCommand as PSObject; + if(obj != null) + { + returnValue.Add(new ShowCommandCommandInfo(obj)); + } + } + } + + return returnValue; + } + + /// + /// Constructs an array of objects out of + /// + /// The result of a get-command command + /// An array of objects out of + internal static object[] ObjectArrayFromObjectCollection(object commandObjects) + { + object[] objectArray = commandObjects as object[]; + if(objectArray == null) + { + objectArray = ((System.Collections.ArrayList)commandObjects).ToArray(); + } + + return objectArray; + } + + /// + /// Called after a module in is imported to refresh the view model. + /// Gets a new AllModulesViewModel populated with and . + /// The is used to cleanup event listening in the old view model and to copy NoCommonParameters. + /// The new ViewModel will have the command selected according to , + /// and . + /// + /// the viewModel before the module was imported + /// the list of imported modules + /// the list of commands + /// the name of the module that was selected in + /// the name of the module that was imported + /// the name of the command that was selected in + /// The new ViewModel based on and . + internal static AllModulesViewModel GetNewAllModulesViewModel(AllModulesViewModel oldViewModel, Dictionary importedModules, IEnumerable commands, string selectedModuleNeedingImportModule, string parentModuleNeedingImportModule, string commandNeedingImportModule) + { + string oldFilter = null; + + if (oldViewModel.SelectedModule != null) + { + // this will allow the old view model to stop listening for events before we + // replace it with a new view model + oldViewModel.SelectedModule.SelectedCommand = null; + oldViewModel.SelectedModule = null; + oldFilter = oldViewModel.CommandNameFilter; + } + + AllModulesViewModel returnValue = new AllModulesViewModel(importedModules, commands, oldViewModel.NoCommonParameter); + if (!String.IsNullOrEmpty(oldFilter)) + { + returnValue.CommandNameFilter = oldFilter; + } + + if (selectedModuleNeedingImportModule == null || parentModuleNeedingImportModule == null) + { + return returnValue; + } + + ModuleViewModel moduleToSelect = returnValue.Modules.Find( + new Predicate(delegate(ModuleViewModel module) + { + return module.Name.Equals(selectedModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase) ? true : false; + })); + + if (moduleToSelect == null) + { + return returnValue; + } + + returnValue.SelectedModule = moduleToSelect; + + CommandViewModel commandToSelect = moduleToSelect.Commands.Find( + new Predicate(delegate(CommandViewModel command) + { + return command.ModuleName.Equals(parentModuleNeedingImportModule, StringComparison.OrdinalIgnoreCase) && + command.Name.Equals(commandNeedingImportModule, StringComparison.OrdinalIgnoreCase) ? true : false; + })); + + if (commandToSelect == null) + { + return returnValue; + } + + moduleToSelect.SelectedCommand = commandToSelect; + return returnValue; + } + + /// + /// Gets an error message to be displayed when failed to import a module + /// + /// command belongiong to the module to import + /// module to import + /// error importing the module + /// an error message to be displayed when failed to import a module + internal static string GetImportModuleFailedMessage(string command, string module, string error) + { + return String.Format( + CultureInfo.CurrentUICulture, + ShowCommandResources.ImportModuleFailedFormat, + command, + module, + error); + } + + /// + /// Single quotes + /// + /// string to quote + /// single quoted + internal static string SingleQuote(string str) + { + if (str == null) + { + str = String.Empty; + } + + return "\'" + System.Management.Automation.Language.CodeGeneration.EscapeSingleQuotedStringContent(str) + "\'"; + } + #endregion internal static methods called using reflection from show-command + + #region internal static methods used internally in this assembly + /// + /// Gets the host window, if it is present or null if it is not + /// + /// cmdlet calling this method + /// the host window, if it is present or null if it is not + internal static Window GetHostWindow(PSCmdlet cmdlet) + { + PSPropertyInfo windowProperty = cmdlet.Host.PrivateData.Properties["Window"]; + if (windowProperty == null) + { + return null; + } + + try + { + return windowProperty.Value as Window; + } + catch (ExtendedTypeSystemException) + { + return null; + } + } + #endregion internal static methods used internally in this assembly + + #region static private methods used only on this file + + /// + /// Gets a property value using reflection + /// + /// type containing the property + /// object containing the property (null for a static property) + /// name of property to get + /// flags passed to reflection + /// + /// property value or null if it was not able to retrieve it. This method is not suitable to return a property value that might be null. + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called from a method called using reflection")] + private static object GetPropertyValue(Type type, object obj, string propertyName, BindingFlags bindingFlags) + { + PropertyInfo property = type.GetProperty(propertyName, bindingFlags); + if (property == null) + { + return null; + } + + try + { + return property.GetValue(obj, new object[] { }); + } + catch (ArgumentException) + { + return null; + } + catch (TargetException) + { + return null; + } + catch (TargetParameterCountException) + { + return null; + } + catch (MethodAccessException) + { + return null; + } + catch (TargetInvocationException) + { + return null; + } + } + + /// + /// Sets a property value using reflection + /// + /// type containing the property + /// object containing the property (null for a static property) + /// name of property to set + /// value to set the property with + /// flags passed to reflection + /// true if it was able to set + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called from a method called using reflection")] + private static bool SetPropertyValue(Type type, object obj, string propertyName, object value, BindingFlags bindingFlags) + { + PropertyInfo property = type.GetProperty(propertyName, bindingFlags); + if (property == null) + { + return false; + } + + try + { + property.SetValue(obj, value, new object[] { }); + } + catch (ArgumentException) + { + return false; + } + catch (TargetException) + { + return false; + } + catch (TargetParameterCountException) + { + return false; + } + catch (MethodAccessException) + { + return false; + } + catch (TargetInvocationException) + { + return false; + } + + return true; + } + + /// + /// Gets the suffix that adds imported modules to a command + /// + /// the suffix that adds imported modules to a command + private static string GetGetModuleSuffix() + { + return ",@(get-module)"; + } + + #endregion static private methods used only on this file + + #region private methods called using reflection from show-command + /// + /// Gets the command to be run when calling show-command for a particular command + /// + /// the particular command we are running show-command on + /// true if we want to include aliases and retrieve modules + /// the command to be run when calling show-command for a particular command + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private static string GetShowCommandCommand(string commandName, bool includeAliasAndModules) + { + string quotedCommandName = ShowCommandHelper.SingleQuote(commandName); + return "@(get-command " + quotedCommandName + " " + ShowCommandHelper.CommandTypeSegment + + (includeAliasAndModules ? ",Alias" : String.Empty) + ")" + + (includeAliasAndModules ? ShowCommandHelper.GetGetModuleSuffix() : String.Empty); + } + + /// + /// Gets a CommandViewModel of a CommandInfo + /// + /// command we want to get a CommandViewModel of + /// true if we do not want common parameters + /// the loaded modules + /// True to qualify command with module name in GetScript + /// a CommandViewModel of a CommandInfo + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private static object GetCommandViewModel(ShowCommandCommandInfo command, bool noCommonParameter, Dictionary importedModules, bool moduleQualify) + { + CommandViewModel returnValue = CommandViewModel.GetCommandViewModel(new ModuleViewModel(command.ModuleName, importedModules), command, noCommonParameter); + returnValue.ModuleQualifyCommandName = moduleQualify; + return returnValue; + } + + /// + /// Dispatches a message to the window for it to activate + /// + /// window to be activated + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called from ActivateWindow() which is called using reflection")] + private static void ActivateWindow(Window window) + { + window.Dispatcher.Invoke( + new SendOrPostCallback( + delegate(object ignored) + { + window.Activate(); + }), + String.Empty); + } + + /// + /// Shows the window listing cmdlets + /// + /// cmdlet calling this method + /// All loaded modules + /// commands to be listed + /// true if we should not show common parameters + /// window width + /// window height + /// true if the GUI should mention ok instead of run + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private void ShowAllModulesWindow(PSCmdlet cmdlet, Dictionary importedModules, IEnumerable commands, bool noCommonParameter, double windowWidth, double windowHeight, bool passThrough) + { + this.methodThatReturnsDialog = new DispatcherOperationCallback(delegate(object ignored) + { + ShowAllModulesWindow allModulesWindow = new ShowAllModulesWindow(); + this.allModulesViewModel = new AllModulesViewModel(importedModules, commands, noCommonParameter); + + this.SetupButtonEvents(allModulesWindow.Run, allModulesWindow.Copy, allModulesWindow.Cancel, passThrough); + this.SetupWindow(allModulesWindow); + this.SetupViewModel(); + CommonHelper.SetStartingPositionAndSize( + allModulesWindow, + ShowCommandSettings.Default.ShowCommandsTop, + ShowCommandSettings.Default.ShowCommandsLeft, + windowWidth != 0.0 && windowWidth > allModulesWindow.MinWidth ? windowWidth : ShowCommandSettings.Default.ShowCommandsWidth, + windowHeight != 0.0 && windowHeight > allModulesWindow.MinHeight ? windowHeight : ShowCommandSettings.Default.ShowCommandsHeight, + allModulesWindow.Width, + allModulesWindow.Height, + ShowCommandSettings.Default.ShowCommandsWindowMaximized); + + return allModulesWindow; + }); + + this.CallShowDialog(cmdlet); + } + + /// + /// Calls ShowsDialog on methodThatReturnsDialog either in a separate thread or dispatched + /// to the hostWindow thread if there is a hostWindow + /// + /// cmdlet used to retrieve the host window + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called from a method called using reflection")] + private void CallShowDialog(PSCmdlet cmdlet) + { + this.hostWindow = ShowCommandHelper.GetHostWindow(cmdlet); + if (this.hostWindow == null) + { + Thread guiThread = new Thread(new ThreadStart(this.PlainInvokeAndShowDialog)); + guiThread.SetApartmentState(ApartmentState.STA); + guiThread.Start(); + return; + } + + this.hostWindow.Dispatcher.Invoke( + new SendOrPostCallback( + delegate(object ignored) + { + Window childWindow = (Window)this.methodThatReturnsDialog.Invoke(null); + childWindow.Owner = this.hostWindow; + childWindow.Show(); + }), + String.Empty); + } + + /// + /// Called from CallMethodThatShowsDialog as the thtead start when there is no host window + /// + private void PlainInvokeAndShowDialog() + { + ((Window)this.methodThatReturnsDialog.Invoke(null)).ShowDialog(); + } + + /// + /// Shows the window for the cmdlet + /// + /// cmdlet calling this method + /// command to show in the window + /// window width + /// window height + /// true if the GUI should mention ok instead of run + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private void ShowCommandWindow(PSCmdlet cmdlet, object commandViewModelObj, double windowWidth, double windowHeight, bool passThrough) + { + this.methodThatReturnsDialog = new DispatcherOperationCallback(delegate(object ignored) + { + this.commandViewModel = (CommandViewModel)commandViewModelObj; + ShowCommandWindow showCommandWindow = new ShowCommandWindow(); + + this.commandViewModel.HelpNeeded += new EventHandler(this.CommandNeedsHelp); + showCommandWindow.DataContext = this.commandViewModel; + + this.SetupButtonEvents(showCommandWindow.Run, showCommandWindow.Copy, showCommandWindow.Cancel, passThrough); + this.SetupWindow(showCommandWindow); + + CommonHelper.SetStartingPositionAndSize( + showCommandWindow, + ShowCommandSettings.Default.ShowOneCommandTop, + ShowCommandSettings.Default.ShowOneCommandLeft, + windowWidth != 0.0 && windowWidth > showCommandWindow.MinWidth ? windowWidth : ShowCommandSettings.Default.ShowOneCommandWidth, + windowHeight != 0.0 && windowHeight > showCommandWindow.MinHeight ? windowHeight : ShowCommandSettings.Default.ShowOneCommandHeight, + showCommandWindow.Width, + showCommandWindow.Height, + ShowCommandSettings.Default.ShowOneCommandWindowMaximized); + + return showCommandWindow; + }); + + this.CallShowDialog(cmdlet); + } + + /// + /// Called when the module importation is done + /// + /// all modules currently imported + /// commands to be displayed + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private void ImportModuleDone(Dictionary importedModules, IEnumerable commands) + { + this.allModulesViewModel.WaitMessageDisplayed = false; + if (this.window != null) + { + this.window.Dispatcher.Invoke( + new SendOrPostCallback( + delegate(object ignored) + { + this.allModulesViewModel = ShowCommandHelper.GetNewAllModulesViewModel( + this.allModulesViewModel, + importedModules, + commands, + this.selectedModuleNeedingImportModule, + this.parentModuleNeedingImportModule, + this.commandNeedingImportModule); + this.SetupViewModel(); + }), + String.Empty); + } + } + + /// + /// Called when the module importation has failed + /// + /// reason why the module importation failed + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private void ImportModuleFailed(Exception reason) + { + this.allModulesViewModel.WaitMessageDisplayed = false; + if (this.window != null) + { + this.window.Dispatcher.Invoke( + new SendOrPostCallback( + delegate(object ignored) + { + string message = ShowCommandHelper.GetImportModuleFailedMessage( + this.commandNeedingImportModule, + this.parentModuleNeedingImportModule, + reason.Message); + MessageBox.Show(this.window, message, ShowCommandResources.ShowCommandError, MessageBoxButton.OK, MessageBoxImage.Error); + }), + String.Empty); + } + } + + /// + /// Called when the results or get-help are ready in order to display the help window for a command + /// + /// results of a get-help call + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private void DisplayHelp(Collection getHelpResults) + { + if (this.window != null && getHelpResults != null && getHelpResults.Count > 0) + { + this.window.Dispatcher.Invoke( + new SendOrPostCallback( + delegate(object ignored) + { + HelpWindow help = new HelpWindow(getHelpResults[0]); + help.Owner = this.window; + help.Show(); + }), + String.Empty); + } + } + + /// + /// Activates this.window + /// + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private void ActivateWindow() + { + if (this.window != null) + { + ShowCommandHelper.ActivateWindow(this.window); + } + } + + /// + /// returns the script to execute if dialog has not been canceled + /// + /// the script to execute if dialog has not been canceled + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called using reflection")] + private string GetScript() + { + if (this.dialogCanceled) + { + return null; + } + + return this.InternalGetScript(); + } + #endregion private methods called using reflection from show-command + + #region instance private methods used only on this file + /// + /// Sets up window settings common between the two flavors of show-command + /// + /// the window being displayed + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called from ShowAllModulesWindow and ShowCommandWindow which are called with reflection")] + private void SetupWindow(Window commandWindow) + { + this.window = commandWindow; + this.window.Closed += new EventHandler(this.Window_Closed); + this.window.Loaded += new RoutedEventHandler(this.Window_Loaded); + } + + /// + /// Handles the SelectedCommandInSelectedModuleNeedsImportModule event + /// + /// event sender + /// event arguments + private void CommandNeedsImportModule(object sender, ImportModuleEventArgs e) + { + this.commandNeedingImportModule = e.CommandName; + this.parentModuleNeedingImportModule = e.ParentModuleName; + this.selectedModuleNeedingImportModule = e.SelectedModuleName; + this.allModulesViewModel.WaitMessageDisplayed = true; + this.ImportModuleNeeded.Set(); + } + + /// + /// Handles the SelectedCommandInSelectedModuleNeedsHelp event + /// + /// event sender + /// event arguments + private void CommandNeedsHelp(object sender, HelpNeededEventArgs e) + { + this.commandNeedingHelp = e.CommandName; + this.HelpNeeded.Set(); + } + + /// + /// Called when the window is closed to set this.dialogCanceled + /// + /// event sender + /// event arguments + private void Window_Closed(object sender, EventArgs e) + { + if (this.hostWindow != null) + { + this.hostWindow.Focus(); + } + + this.window = null; + this.windowClosed.Set(); + } + + /// + /// Called when the window is loaded to set this.Window_Loaded + /// + /// event sender + /// event arguments + private void Window_Loaded(object sender, RoutedEventArgs e) + { + this.window.Loaded -= new RoutedEventHandler(this.Window_Loaded); + this.windowLoaded.Set(); + } + + /// + /// Sets up event listening on the buttons + /// + /// button to run command + /// button to copy command code + /// button to close window + /// true to change the text of Run to OK + [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Called from methods called using reflection")] + private void SetupButtonEvents(Button run, Button copy, Button cancel, bool passThrough) + { + if (passThrough) + { + run.Content = ShowCommandResources.ActionButtons_Button_Ok; + } + + run.Click += new RoutedEventHandler(this.Buttons_RunClick); + copy.Click += new RoutedEventHandler(this.Buttons_CopyClick); + cancel.Click += new RoutedEventHandler(this.Buttons_CancelClick); + } + + /// + /// Sets up event listening for a new viewModel + /// + private void SetupViewModel() + { + this.allModulesViewModel.SelectedCommandInSelectedModuleNeedsHelp += new EventHandler(this.CommandNeedsHelp); + this.allModulesViewModel.SelectedCommandInSelectedModuleNeedsImportModule += new EventHandler(this.CommandNeedsImportModule); + this.window.DataContext = this.allModulesViewModel; + } + + /// + /// Copies the script into the clipboard + /// + /// event sender + /// event arguments + private void Buttons_CopyClick(object sender, RoutedEventArgs e) + { + string script = this.InternalGetScript(); + if (script == null) + { + return; + } + + this.window.Dispatcher.Invoke(new ThreadStart(delegate { ShowCommandHelper.SetClipboardText(script); })); + } + + /// + /// Sets a succesfull dialog result and then closes the window + /// + /// event sender + /// event arguments + private void Buttons_RunClick(object sender, RoutedEventArgs e) + { + this.dialogCanceled = false; + this.CloseWindow(); + } + + /// + /// Closes the window + /// + /// event sender + /// event arguments + private void Buttons_CancelClick(object sender, RoutedEventArgs e) + { + this.CloseWindow(); + } + + /// + /// closes the window + /// + private void CloseWindow() + { + if (this.window == null) + { + return; + } + + this.window.Dispatcher.Invoke(new ThreadStart(delegate + { + // This can happen if ISE is closed while show-command is up + if (this.window != null) + { + this.window.Close(); + } + })); + } + + /// + /// Showing a MessageBox when user type a invalidate command name. + /// + /// error message + private void ShowErrorString(string errorString) + { + if (errorString != null && errorString.Trim().Length > 0) + { + MessageBox.Show( + String.Format( + CultureInfo.CurrentUICulture, + ShowCommandResources.EndProcessingErrorMessage, + errorString), + "Show-Command", + MessageBoxButton.OK, + MessageBoxImage.Error); + } + } + + /// + /// returns the script to execute + /// + /// the script to execute + private string InternalGetScript() + { + if (this.allModulesViewModel != null) + { + return this.allModulesViewModel.GetScript(); + } + + if (this.commandViewModel == null) + { + return null; + } + + return this.commandViewModel.GetScript(); + } + + /// + /// Implements IDisposable logic + /// + /// true if being called from Dispose + private void Dispose(bool isDisposing) + { + if (isDisposing) + { + this.windowClosed.Dispose(); + this.helpNeeded.Dispose(); + this.windowLoaded.Dispose(); + this.importModuleNeeded.Dispose(); + } + } + #endregion instance private methods used only on this file + } +} diff --git a/src/Microsoft.PowerShell.GraphicalHost/generic.xaml b/src/Microsoft.PowerShell.GraphicalHost/generic.xaml new file mode 100644 index 00000000000..b074aa23070 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/generic.xaml @@ -0,0 +1,2799 @@ + + + + + + M 0,0 L 4,3.5 L 0,7 Z + + M7.3391155,8.3084572 L7.3391708,16.109179 10.974259,12.431834 z + + + + + + + + + + + + + + + + + + M0.83647823,8.3277649 L5.9975096,11.519699 11.198949,8.3030383 + + M205.63696,8.9046901 L201.73368,12.456607 205.68294,16.093484 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/GraphicalHostResources.resx b/src/Microsoft.PowerShell.GraphicalHost/resources/GraphicalHostResources.resx new file mode 100644 index 00000000000..0a86d51a82e --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/resources/GraphicalHostResources.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + OutGridViewWindow Object + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Add16.png b/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Add16.png new file mode 100644 index 0000000000000000000000000000000000000000..e5b964d9199dadd4c8a94b5a62cc29e118b0f9cb GIT binary patch literal 550 zcmV+>0@?kEP)z@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZ-oJmAMRCwByk~?b^Q51#0^O~o55YkxLh}sJ_dIOfG zvJiiR_W2q1mX;z~h@gUz@;j(q!3lK=n!AY({UO#lFTB>(_`g8%^e{{R4h=>PzA zFaQARU;qF*m;eA5Z<1fdMgRZLO_sdG9QleU|ejo_KEmc*2(lqT0BKimaVPs?^7Kub= z!r|~_xmZSy)jF)$;9)GASvF@+^R-g}uGKAC8ZY8vvl|I#Q`rtW+vZg~Q=lpU0EgT(%}4wD`+=UGp2tI>kk7I#w6(PbJ32b@iA3V5 zTrPL3wY9ai*=)jfU97IITFcAJzYx&_0Dmwd0%NQt9*@6MEEcCbJ3A%LISYkC@H`KO zVZgR+0HE#d?aQ^bwck9?`x3x95j7YQ0RR|dt&$|ojE;^@ClZNv(==gO7A(sG0Gytl z>Xl06S0effz#0+R03cp3O+;skqI`3Bc=*iO*;#wNUWeoes=H}))n$6~inx?&a zb#)~&#vn-&g25mzE-p~7*AWZ`J7{||zF}XLnNleVkj4#R53~ZWVrM1hdekfLC9|nce!OGUHvejBCTcL9;bsJ-9 z?E<4^WiuAb*@Vp=1f-BXOb7Jrj$4Kj!yece5-F{&Uu>Rs}8=_oE`wTaIveVvZy~cd=|7 zdDzuu!<(CXrCP0&4~N-14#$_iczon$Fv$K5Zy!1&r)09T%9fUk5{*Wd-rVG-XJ^0r z^zq}*kY%fNOWE032M`2EBodH|M3~!7r~RtiJwz1>%+kJn6(+s@T*_>|fK^uF0*(VH zlzU-;=$oIvjEq?*@wDTaYWBtn1Ta9n4@;jwcqEw7tfTL&2&m!s)4 z5JCOEzMdL(xtx>H=nbR}$CW*`wU^#GaNsPaQeiov5J*uJM8aVzMiA>Y27^IaRi!Wf z)p^P5p_JDlzpq%@;eC{*>;*Iztkv7Aw;)e;^>5fmCBxg5wss4STTqHMOf z!Z4{px7%@-ByT|MXQ(u?YtiZpMq~fGO-*OCWo6p@_BIgEG(g}j9b zeiOc(h02zo-3DN&y}hoJVa8tw23vCs1B&@P5W#vGj)U=`D53 zLLPR;WHNw2?Z6QdsT9EAVg+XN&W|e9E%@1nm%U!%nE}W3#!M(4cV5W*ZkemmoGoh)o^fpQ4T zAslFI%nkAU{ogol;-psl(rX;|W^i>CBePi`7m0udnmnwm{C4=!qY-51$dP#3=~NX9 z1t5bkX)@()Fe1ChW6Pvc_pE#N)Sj-c{;(q&J+-yEibkNx^J+Cv9z4i@u(9zTGI{v$ z)wXD~ACE>cQm-$L0x)A=Tf3IwxT#Xkr8ztH?yY`9r@P!vQE$_MfSA%~@;{;I(jA}g z8gjm^P17Zp+g{A&j($zkE2AqbHVEH?Txxe*FPltt?;DL*ngxPm_HcOl8^7O1Clb@o zQuw%|quxW3uRM7Al!zsh4@$v+|2f?a4NcPW@>l1AL6T(INmz>i32iK~=UQe!1^@s6 M07*qoM6N<$f_rS*761SM literal 0 HcmV?d00001 diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Error16.png b/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Error16.png new file mode 100644 index 0000000000000000000000000000000000000000..8fce7ba03df609f47f3591113b48a09edc29f2e9 GIT binary patch literal 782 zcmV+p1M&QcP)%0v24;doh#GPumqJB#Vkm@s!~a0#-<97}&ua&zW^)8NU{OVs7@w`jTa_ ziMZ|((6kq@6I>;hNH54DqrkPTfbne-&hOLsy|smHHX9D&UlSd{_}nZeOruZ8{hMyc zKR_)BzM4!?p!#|d7$wAfV*`8-g=5R%fPHobL3w#_T32DsI*l)@HaA2=0M}@4&E(my z(h`re#P9WBUs8Z65@DgL3RBh9aKHtw@-l)o8aPcR*tB(6IF${ zpC0SF`(Q>2z*j24Q7Evnxe1G93I2Q@%#DqBSy_ot8V#{|`Pfhtqv!1#gB!4NKL28n zul5eM$H!nb8sYHqL3B+G{ECa=N2kN0)1ke*93t{69@(>EV{t&&f)~$PY+eAp`Zmm+ zudz;&My02NS5N?MVIf>(ztP!=p0YA<%x3ryK(I`PfQPMKfJZ{`^QV|?egsZrBtq0` z@N#pp(Ax_q`D;K*3jFnYbeEJsFh37wb`I=Hl~;l%iQ<_VIC{E3sZ`*T;6;N0Ey>9^ zOaPgKgW$)-VY{mf4{~yF;>InE3x(b!ddiq2JIb=Rw?ZI|L1=0!8Zt5SqIqdNXFp-(~ua);bO#2zVI{*Lx literal 0 HcmV?d00001 diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Help.ico b/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Help.ico new file mode 100644 index 0000000000000000000000000000000000000000..f6b92d0b8c2d0f174335c827cab18f74064b260d GIT binary patch literal 10134 zcmeHN30RiZwq71BIQKYap>{IJtPC+x5gB9<5hp^#0dYVu5C-xW8uf5m$)?Ry9 z??R-FJT7Ktoq261U;RO3wup4@-1OY1jfh8EVZE^4SoRo;gtSxjP0w>46M42nOTC%w z;roauTI$VY4tZaBUZfBEWEbL0QgXCHS-)JuMfhLB!<#PrW;*J z>XrJ@N@QqgSo19}#-VyNG=zpXzcCJL2n`Ghij8c35q3937h*6NVk0#MqlRU{>aonA zU#woNig24eGAu-=)6KcdN23PUfZ$Ml133)(a1ni^+lYWUdcE$;3d2b~*_QN$d)(m;BBbYxI0pr-}HXb&TOjDeP!L-m^s8mo`dMc3)-A}Yd^J;f+i9~}|> zr7q}Xlf5OZL0=boCR!iM)~XnX#p+oej+YwGh6a5^xK^wE{5anDwi6KE1`jwA_eGo< zL`=UG>GT-|6^OJ|6iydxA^DZk!l$kU&Fw#9U#d^lx00b`DVa)kAEED)%t$SM9?tt; zF5z@)*3hrD3x9e08~xlkRP$&WL$5qJQXdkk52LY`&51Tdh8sn=husaDVbrcjgI22+vGj6@3BQr|XB#4q{9(o(N@RU6e-*~yILOj7HLR@yaP zv|skg3a#ioY~{^K!)4*ZMY3|GPTqQJl|)-UF42S9%Z9-nB+j~{Y_{nnJ8U{i?2soU z#`a0sWcQ?OvwuQ1IP{RMPCX=XNP9_gcv3by|5-LV_mmGv@h&}Om$Qi^yZ%}Bk2IBo zqf8}Y*z@w9o4IUueNN&>JSW>nzaSgN^phQ9%_U}>wQL+WShjf%kR9F*k}#&X92oPw zB)w`b2gmi1v~e#Df7~fYiJYSUb34JAJ0_!}i+yGThBtR!{P zVA(%$upIIkA_pefO6m+J+2>;`2T6yf4wXZ`j`Go@0g^Xipd9rXBze=UB%OR|KK7C} z)j_gI>C>Gglax2jQBIBME0xss?5hLhjOQRJ_p+9=o>p>d;t(mCZYAZuR#Gy_j?Xqy zJkv%B*uKQaK@5K6^S72#e_J^nFjOjE8zL71?WHEjUM|dWl-hYt5=;BP=i@3-)7@ng z?>F*()0C02bJ|Er_8lfEGn^%X&q*`KN$zxK**0s8toENMtLMxR{ajy(o9!i=XZuKk z|2Ww*dyMR#;~}}TT_tTpE4s;2y~rktV!6F_g{)c?E-^8&@`3(s*%70c*x2>*!3Q76u1ztL zxnZs3Y+Nh(aqmh_!WPL$-XS^3+axhDQBsod_sAhhOG}fi zBS$1JGeeFZ&6e!!Y{}2fmHZR=QW5u#l*UKNH#=8L`R=V!xi4O>9o#0@cW;oAeMwUM z(IKhL-Y3Ob=~8^+gnXWvEMI3PN?`%p7M+mG1xMv#QJ!2onJ?cJ9+J9}Ecx1yD|d>I z$noQaQk-9)?Wv`Og;G{rB8HMOIbB*Jr%xK>%$YM%d8$k-TQEEOuFV)pGQd?UqS4g#&ugH}vSLF8PD!G3By4<{ZQ*PJY zmWG>O%AK2E3+~*Kztz`EL;ZJh@7_JR-`FU)e^2iH@IW3s;EKw^O+~x5{A8rIYumP6 zYDUZRPp%p5(rfGL8yoBEYSY_2!jh9(TmSi<*8^q+1}**Iv-;Z9oS!t_cdY*CqUWt0 zMlD!7Ws>Kh`I+^{_O)Wzd!uggGbX*P?Q91On=;YU!+mV<%^Q0kGVHxm(Z;9)>#g58 z7-u(elBb7<`@oZTS{U}-U^VMa&9>gS`B#Ih#^5oq{6>?AoMUx=c-+XSeP`2N<)7Bn z-dZtn3OOcu4!C(-Q!=%Fm9Z)vOw10~9IyE-%zFw8nU>Y3QiY7;$9w+ikH*IBJDQlx zKb%*-(baqOg0*X>Oz|Feq?UHrRsVMPPMtcnH}2Tc)YR14wx7f3(F@4pJ<5Ad{VtL8 z8w<@9L#K`%yYyPQa?Oi&4x^n$j~+G3+tv15x@6R*+x9o_-c@n@%kmpHZoFYJ)WN}F z^e6`hSKCcB8L4%E4+|I>=0 zM|th1rz+AxQ~~YmrMVryHkknQeIx|n$Ep?S(sV8WYO!n#`NYuB#2oV?RF4s`Cu(#xb<@5Z+6>NojKpRQPJ$sNN{*3HzU zTeqI|?NaOZzsve*(^~q7|FW*WvU3-9U}_Rjmzq(VwVfSAkj2H)g;L(CufJPwWvUoD zZ=nIxZxp=ir-}G*YybY1PZu;c-fLLa$AYEX=jqD6X-R%jMny%4q==adz1tdMO3jby!52iZKNqr~$}5^HB7>j!t1jW(U-gP~8!PWvtr zH`GKnJ3TFlL!Xe;Vcq0_i;1L;=qX!A^pdS3d&|x-ePoBHr6i1ePEtnqk^`g7Bxzhf zIl?nWl4pN8$n(X1ul|zhWiERsTl4H-Eh#)NB=Y>A&J9PsE#(CFe05$pF~gc?1$*8* zNtwq$De$$H61DI9*-H5=JE`JcUpd=eYUlDi!96^ev~|{4*%9C_hx~`jF27N7aF)C5 z=6?OrtYLC&_HfA#a+4FUjg{1S6Xe*!$+BmpV2T%>yO7%{v#Q_919q$uPyF)Z_!^0o7%Lcc(2-VTu3 z=tXiVW~uyZyiVSWijwu~*UPpoTO@bm+mf?$qa07zB*#*B%C5u&Nl8hOBWXwEM9xtu z*t$+mZ;v9qFU84Qq`c>f1^@UuNj^O67m`9E!ehvyW(DQ((J@oV{3KW|_EkPv@g@1{4tK8vO~ zSq~Wzu*k=kEPg(V20d=}df3pHJ%fG7;k{^3TO+gOA&$NKdM@%7Ki}z(wKZ<<;A}cz z;J{hFepCG2I(K;NvA}sOZATi0$*;I{abQis4^%p+~1@R<7*Q-o}55pYPoM{l<9Nzq)GGV3Vo7ev~)q75BGRuU@Tt z#(9Ca(&zPwmXnt)3mWAzPw6AnclLy_V_$u3fu=7xe)>J?8-Dy=71RCK#e-(-oH3;e zq-%wi-SHkNT22i#)V+)h7un~luxolg{Ku56N7Oh7!zqWQhlhtRG+^^2l9DD5~H|q z;Q|(Ig%#~!hUZX9GYZ}wDE(GJz+44eTJfJvOO3dqrzh#7&C*h zGZ?#qaST*ns!!GTKhr_!sQ4J)fbkYqc-Z6JLG2N1_Y^j{m}1+QK1lSmL@IS)+=|={ zYr%LEhbIn2$s`*v4#(;7gK>7;Kvayiq#myz?Nw_Or5}Xqvss5n!4YsdU9d^XReGo^ z$ADN9;#{5u@e$-C#^FR}21;pH;tO*V>$2cB2yFS#` z2_;j>ryeh;^+L^AVj@U(GQke}CqS$Vanyl07&cL#O*T(pvqLw;xtb!Lw9V}~BzX-4 zu_x^3HEo&$GAQ>bDTkCxQo8V*NOD9T<>&d>gZK_^e*HDxcw>dKfwrcqHB0#hF&+^2 zLb7vr>>Sz^J4jpYx*(3UMadufB(^wq$BuFRkodYU5|{cTIW!Q&&ai*-5b&&uBh-T! z7KmXXOA+N~Q9iLPWN~~BD4#4kfrNyFM#@)f^(M7$5=#MbGo(+nXx5<{5*?q!PKPHo zTg1~I@%9`8j>n!LcM!8c<@pQr=}REqgk+Dt*i9Yw``F>&RC`SqWfP647cn-Zag5R? z4n|V=QWO>zK2Wkr1#0ak_JgC7EO2zPB{E5eJo{kRux?1A4hhsj*3`CYU$8`M5*zMW_DNavOkEb*}w$la)BTP|}bp*tBP?DdI63)Z8po#R) zo=6&Jfu!-4qyb2#U!*7>(P)6?E4#RU5%bj6W+j`{p!Tu2#r_~}i2NCY>AzO=8R{|B z3K=rwuqxgjv(s@=U{Fws;jC&ybkM!cE|P+X4vZ13yi@KugL9r?S3n->qqx(Enl;L z@|qBw58^)dnmr7p5QmGC|x8#Lu|C z+(ych>Db8m63?|lky;=++QOB?fu~Jmcam2YG2b`Vlh|_`8gSII3w*&EIoba|p&cwbrHl6F3 zriT@Xk%QPSZgEZdhTr~gcfKPOcnieTv13>dYO-s@H%pG<9)knorzqX_9*8T0_$`Qe0zW*!5BKg7^1O%dZhnP*JR|M* zG{+vwPo?~narFN&y%9ItQ#+rjHJ`q(ol{%(pW@$IPK|c4omi?!B4|=%& z62As9aa>z80-sQR?ZOebL>-tz05RrY7S6Z)eB9@i_%N6U;C$_iv`Mev@C2^sUo90O+ z^{EIPiqq7mY^o)S{p^vwDFVzH{O0p_lLnd&!q6+IW9FQ*>! zoi&?WnePPVwNOP{RC4WN&IruapuDu?cf}vAba*8GQs;zXp3O@#4uiQHFsB6Om{1z0 zN9n#q6l7)Ka_!~+bo|w#gSv7&{zu}^);cun@!t}EqoA!q*zjw){h#aeYtP}#HY+Ol z2RVKvQ^{6&>mT#`W_)4}yLH}Ld-LeelGm5Gk=Bt6q;H!^-K%$QkG5!f!#XokbmZE# zeOZL+!Q6p^FZ7b#A-oI7sPZyd=|t>K@1d%hy2N{ z``~@FdT%(E4PwHKYfX^CGcs{f5Dx`0U=ULVv0D&NZRsOg>A<#bN-rgsSTcx-GdAlC zV$>k63Sz1tb`0XwARY~3z$oSSG=Ga`EA?%}d9h_kM{H(HLku0n%|YB5#G66f8^o-U zOHy%5Vf;GH9+a)wS=op9Gl;E&xI2i)BYx;pATA8z!8}{`0rB&uvp-`1V%C~{*%d|zAdiNAyRI*8wc*t>QPA#M%g{9vvD#MWEePa8kt;vfzW z<_SQ|9>lvroEzM}wL%v+GNp?m{+n@Mvt3H0${88;&3ibF8 a&EIc3{kFf2Y3VFy&aOr2O70qX79SWg3l7$s)UH(c^(_p zDoQEhIOf``W7{^CWn~*2H%KSNaf7r7&}`lCHcT=PybNA{?BQ?u02ptBb!}+y>i_@% M07*qoM6N<$g5!&WbN~PV literal 0 HcmV?d00001 diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Save16.png b/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/Save16.png new file mode 100644 index 0000000000000000000000000000000000000000..66893c82d66b96800051581927def99e063be844 GIT binary patch literal 605 zcmV-j0;2tiP)bYPB%N05F|SBc+s5?RNXq@$s<$hzKG=2!Rj+-upVQ{zU|U zgM$MBKB%H7ocF%&uPS)^ejBZ|gbsED}^0RrUDRq9}S7 zD+egc@G#U-O_Y_6(ZUb6t%CbZ$ z^+KSv#yQ9S{ywX#s|*GMM1=MAbwUUfML}7XjK^d8{XUnMmvlOvzXX-s`FzgC#s-In zhwSa`p_Jm}_*ZAPOJd7hJ|DHj(PXszp6#EZugLcm%}p64i~==b~F-QAI88P-}R zlL_AY8VnGNh<47^;HRf2%Cbaj&1f_tO;fD3IOmwnW;o|wtu(gQ&Wtf_tu-P-mSvos zoiUkAD2k%GIHD*bNfH{321$~TBndzgUtL{&U0YlG7D8yQtgL(<3LUh^IY!l?`OSU@24@Q1N{C23EZ%RcsiTr00000NkvXXu0mjf5A+}I literal 0 HcmV?d00001 diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SortAdornerAscending.png b/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SortAdornerAscending.png new file mode 100644 index 0000000000000000000000000000000000000000..a58856e553c03a0e9a0036ab12a8514a4ec3286a GIT binary patch literal 264 zcmeAS@N?(olHy`uVBq!ia0vp^>_E)I!3HFqj;YoHDV-A6h!W?b)Wnj^{5*w_%-mE4 zUm(NKP{FY@UBSq}z(T>m(#q5bh!k`UEDQ`56huD-8C2rw>&kwEgImCi$J3>a2Pni@ z;1OBOz`%DHgc*L2%K z#)b}#DODfq4ZY>tUUhc=JA6dKQA=rZ(f`%Asti|1%`_@7Ha05Qx9{YGml;P-ypWmy z|Guh5&%ql3^B;bHU(fR=$A>4!fz|%Mp#cL!n46ZI?b8@-pj8Z>u6{1-oD!M_E)I!3HFqj;YoHDV-A6h!W?b)Wnj^{5*w_%-mE4 zUm(NKP{FY@UBSq}z(T>m(#q7>%D_-T*TBNSz-*U_63CzuPhVH|8ywsMWE)e-c@N`~*)I$B>F!$y++Lf2~h@eD1*U z^QR9SIdVwh#QF0IM-HDmaO%W?13z9qmv3wFeEna0)oY^_Cp!&23XP39iVTcjbQT&I z88RGf+T(Cce}A3vhoTLKR2?4iD9kmmdHrSc{}VL~Yh9JsTr%3Q1ZWq7r>mdKI;Vst E07Z>m7ytkO literal 0 HcmV?d00001 diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SpyGlass10.png b/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SpyGlass10.png new file mode 100644 index 0000000000000000000000000000000000000000..71abc2ecf3214f36c69ddf66da91831c562a5a32 GIT binary patch literal 403 zcmV;E0c`$>P){J?NUo}Yn9 zk(Ys0N?zvH=fA89aD{6&Zu|G|*Vm6u0@ xU0jX=CE1ZB(G`Yxd3ntPDl)>Q2!sIw3;-ZlyHOVaG9Lf{002ovPDHLkV1f*Vy4e5# literal 0 HcmV?d00001 diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SpyGlass16.png b/src/Microsoft.PowerShell.GraphicalHost/resources/Graphics/SpyGlass16.png new file mode 100644 index 0000000000000000000000000000000000000000..37cf86490d472e408cc6df9f88816692a5486d08 GIT binary patch literal 736 zcmV<60w4W}P)<5NowK`|yq28N$M z|1jRU|CoFKhGh?LT|OPVYTbq#Ahk^Bn%f#`gJcaIvOX#Lt&)`ze8b1e@R#8q!`J@| zEN`V%6t8G{rZNag%h$HGG;xB|v!EOB@bLp{Deb81KN(r>b1^a)-g(V%>)tzt$De;P z{O03i;N}$(W0%o1m%D#zt1D3XCJYz6egBDxRaEuC&mRmQPd#SXfBP-N8DTC4216+Z zaSag$F(n}eJ~mP9-z+R_##mjz!O6qS$;R~k=U;}WJgf{t_DT#U-+wXu`SF|KH~+|G;o)^G$}8{}~xBF)%aSy#IsY@Q1hG1Ws;U z^zQec|3|SJ0F2hV_pY3KBlP@eV2<%0S#y~`pML)O{r&InKW~{nf9BXXCEIl8uAOuK z{r~?AYdYv^?{$-vlUu)h*_`jX7B1HwTs<`jBrdI@tNHZawcusTSLOq`CxQBYV1z+R zLYhTjNXX_hXO6RM-nJ`QKv4LVgp_nV$cn$;-Z8SXvH1d-PyQp@3SxtBLTr-y`ZZgg z-@kkRzo4MtM4%KuOb#Cg6G?H&0!tPyKmYXc)Bh$WCWnBUHHpy-H(=iE1$&-9ef~cx zD)I?XvnwoYh&Ev9qUHaqDl7l9u(0HS(h{+n;RYBQ7fEXl?5B&fCA1M8qg%bS#|0folxc(E%Kl@KC Nf8;;0{NTr~4gmTpKiL2P literal 0 HcmV?d00001 diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/HelpWindowResources.resx b/src/Microsoft.PowerShell.GraphicalHost/resources/HelpWindowResources.resx new file mode 100644 index 00000000000..3bcab7bfb8a --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/resources/HelpWindowResources.resx @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cancel + + + Match Case + + + CommonParameters + Name of a group of parameters common to all cmdlets + + + Description + + + Examples + + + _Find: + + + Help Sections + + + {0} Help + + + Inputs + + + {0} {1} + + + Methods + + + _Next + + + No matches found + + + Notes + + + OK + + + 1 match + + + Outputs + + + Accept wildcard characters? + + + Default value + + + Accept pipeline input? + + + Position? + + + Required? + + + Parameters + + + _Previous + + + Properties + + + RelatedLinks + + + Remarks + + + Search Options + + + Settings + + + {0} matches + + + Synopsis + + + Syntax + + + Help for {0} + {0} is the name of a cmdlet + + + Whole Word + + + {0}% + + + Zoom + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/InvariantResources.resx b/src/Microsoft.PowerShell.GraphicalHost/resources/InvariantResources.resx new file mode 100644 index 00000000000..62924692a43 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/resources/InvariantResources.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + {0} cannot be modified directly, use {1} instead. + + + Columns + + + {0:G} + The format string that is used by the InnerList in the case where a DateTime type is used. The {0} will be the column value. + + + {0} + The format string that is used by the InnerList in the default case. The {0} will be the column value. + + + {0:N} + The format string that is used by the InnerList in the case where a floating point number is used. The {0} will be the column value. + + + {0:N0} + The format string that is used by the InnerList in the case where a whole number type is used. The {0} will be the column value. + + + {0} does not support adding to the Items collection, use {1} instead. + + + If View is set to a {0}, it should have the type {1}. + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/ShowCommandResources.resx b/src/Microsoft.PowerShell.GraphicalHost/resources/ShowCommandResources.resx new file mode 100644 index 00000000000..5853a0a3c01 --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/resources/ShowCommandResources.resx @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cancel + + + Co_py + + + _Run + + + All + + + Modules: + + + ? + + + Help + + + Common Parameters + + + Errors + + + Parameters for "{0}": + + + Name: {0} +Module: {1} ({2}) + + + The following errors occurred running the command: +{0} + + + * + Used in MandatoryNameLabelFormat to designate a mandatory parameter with a * + + + {0}:{1} + This is a label for a control, hence the colon. {0} is a parameter name, {1} is MandatoryLabelSegment or an empty string + + + {0}: + This is a label for a control, hence the colon. {0} is a parameter name + + + Name: + + + OK + + + ... + + + Command Name + + + Modules + + + <No module name> + + + Select multiple values for "{0}" + + + Can receive value from pipeline + + + Common to all parameter sets + + + Mandatory + + + Optional + + + Position: {0} + + + Type: {0} + + + Imported + + + Not Imported + + + Show Details + + + Failed to import the module required by command "{0}". Module name: "{1}". Error message: "{2}". + + + To import the "{0}" module and its cmdlets, including "{1}", click {2}. + + + Show Command - Error + + + Please Wait... + + + Refresh + + + There are no parameters. + + + Click after using "{0}" to see the new commands + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/UICultureResources.resx b/src/Microsoft.PowerShell.GraphicalHost/resources/UICultureResources.resx new file mode 100644 index 00000000000..32ae43c624c --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/resources/UICultureResources.resx @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Select Columns... + + + (none) + The group title for items within a column whose value is empty/null. + + + Value should be of Type {0}. + This text represents the error which will be shown when the entered type does not match the type we are expecting. {0} is the expected type. + + + The current selection is empty. + The error validation string to present to the user when they have selected a value out of bounds. + + + contains + A filter rule that indicates a field must contain the specified value. + + + does not contain + A filter rule that indicates a field must not contain the specified value. + + + does not equal + A filter rule that indicates a field must not equal the specified value. + + + equals + A filter rule that indicates a field must equal the specified value. + + + is greater than or equal to + A filter rule that indicates a field must be greater than or equal to the specified value. + + + is between + A filter rule that indicates a field must be between the specified values. + + + is empty + A filter rule that indicates a field must be empty. + + + is not empty + A filter rule that indicates a field must not be empty. + + + is less than or equal to + A filter rule that indicates a field must be less than or equal to the specified value. + + + ends with + A filter rule that indicates a field must end with the specified value. + + + starts with + A filter rule that indicates a field must start with the specified value. + + + Back + The text representing the tool tip and help text for the Back Button in the Back Forward History control when the button is disabled + + + Forward + The text representing the tool tip and help text for the Forward Button in the Back Forward History control when the button is disabled + + + The value must be a valid date in the following format: {0}. + {0} will be filled in with the culture appropriate ShortDatePattern + + + The value must be a valid number. + + + Search + The default background text of the search box. + + + LeftToRight + This value will be loaded at runtime to define the flow direction of WPF application. This value should be set to "RightToLeft" for mirrored language and "LeftToRight" for others. + + + + An ellipsis character. + + + Ctrl+Add + + + Ctrl+Shift+Add + + + Ctrl+Plus + + + Ctrl+Shift+Plus + + + Ctrl+Subtract + + + Ctrl+Shift+Subtract + + + Ctrl+Minus + + + Ctrl+Shift+Minus + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/resources/XamlLocalizableResources.resx b/src/Microsoft.PowerShell.GraphicalHost/resources/XamlLocalizableResources.resx new file mode 100644 index 00000000000..caff99962fd --- /dev/null +++ b/src/Microsoft.PowerShell.GraphicalHost/resources/XamlLocalizableResources.resx @@ -0,0 +1,414 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Available Columns + + + Add + + + Remove + + + Selected Columns + + + Back + Localizable AutomationName for control that is used by accessibility screen readers. + + + Forward + Localizable AutomationName for control that is used by accessibility screen readers. + + + Find in this column + Background text shown in the search box. + + + Expand + + + Name + + + New Query + + + Tasks + This is the title string for the Task Pane. + + + Tasks + AutomationProperties.Name of a SeparatedList. + + + Indeterminate Progress Icon + + + Add criteria + + + Overwrite the existing query or type a different name to save a new query. Each query consists of criteria, sorting, and column customizations. + + + Ok + + + Cancel + + + Click to save a search query + + + Available columns + + + >> + The contents of a button which indicates that items will move from the left column to right column + + + << + The contents of a button which indicates that items will move from the right column to left column + + + Move up + + + Move down + + + OK + + + Cancel + + + Select columns + + + Move selected column to list of visible columns + + + Move selected column to list of hidden columns + + + This column may not be removed. + + + The list must always display at least one column. + + + Selected columns + + + Find in this column + + + Expand + + + Click to clear all filter criteria. + + + Click to add search criteria. + + + Click to expand search criteria. + + + There are currently no saved queries. + + + Queries + + + Delete + + + Rename + + + {0} rule + The text representation of a rule in the filter panel, displayed to accessibility clients. {0} will be the name of the rule. + + + Add + + + Cancel + + + Add Filter Criteria + + + Value + The name for text input fields + + + <Empty> + + + Rules + The name of the panel which contains the filter rules + + + Delete + + + Query + + + Queries + + + Search + + + ({0} of {1}) + The text displayed in the management list title when the list has a filter applied. {0} will be the number of items shown in the list. {1} will be the total number of items in the list before filtering. + + + Searching... + The text displayed in the management list title when the list is processing a filter. + + + ({0}) + The text displayed in the management list title when the list does not have a filter applied. {0} will be the number of items shown in the list. + + + Filter + Localizable AutomationName for control that is used by accessibility screen readers. + + + Filter + + + Shortcut Rules + The name used to indicate custom filter rules which are specific to a particular application. + + + Columns Rules + The name used to indicate filter rules that are based upon the properties of the items in the list. + + + Sort Glyph + + + Sort Glyph + + + Collapse + + + Collapse + + + Sorted ascending + The text used for the accessible ItemStatus property when a column is sorted ascending. + + + Sorted descending + The text used for the accessible ItemStatus property when a column is sorted descending. + + + Collapse + + + Expand + + + Search + + + Cancel + + + Clear All + + + Clear All + + + Clear Search Text + + + Tasks + + + Search + The accessible name of the Search button in the filter panel. + + + Cancel + The accessible name of the Stop Search button in the filter panel. + + + Expand or Collapse Filter Panel + The accessible name of the button that expands/collapses the filter panel. + + + Filter + The background text of the list's search box when filtering is immediate. + + + Click to display saved search queries. + + + Filter applied. + + + and + The first header operator indicates that it is the first item in the list of filter rules. The AND value is used to indicate that it is and'ed with the above SearchBox. + + + and + The header operator indicates that it is the first item in a group of filter rules which are the same. The AND value is used to indicate that it is and'ed with the other groups in the panel. + + + or + The Item operator indicates that it is NOT the first item in a group of filter rules which are the same. The OR value is used to indicate that it is or'ed with the other items in the same group. + + + No matches found. + The text displayed in the ManagementList when the filter has been applied but matching items were found. + + + Collapse + + + Expand + + + Show Children + + + Show Children + + + {0}: {1} + The format string used for the ManagementList title when query has been applied. For example, "Users: My Fancy Query" + + + Cancel + + + OK + + diff --git a/src/Modules/Windows/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 b/src/Modules/Windows/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 index c2fb5548240..6f03791304a 100644 --- a/src/Modules/Windows/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 +++ b/src/Modules/Windows/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1 @@ -23,7 +23,7 @@ CmdletsToExport = @( 'ConvertFrom-StringData', 'Format-Table', 'New-TemporaryFile', 'New-TimeSpan', 'Get-TraceSource', 'Set-TraceSource', 'Add-Type', 'Get-TypeData', 'Remove-TypeData', 'Update-TypeData', 'Get-UICulture', 'Get-Unique', 'Get-Uptime', 'Clear-Variable', 'Get-Variable', 'New-Variable', 'Remove-Variable', 'Set-Variable', 'Get-Verb', 'Write-Verbose', - 'Write-Warning', 'Invoke-WebRequest', 'Format-Wide', 'ConvertTo-Xml', 'Select-Xml', 'Get-Error' + 'Write-Warning', 'Invoke-WebRequest', 'Format-Wide', 'ConvertTo-Xml', 'Select-Xml', 'Get-Error', 'Out-GridView', 'Show-Command' ) FunctionsToExport = @() AliasesToExport = @('fhx') diff --git a/src/System.Management.Automation/System.Management.Automation.csproj b/src/System.Management.Automation/System.Management.Automation.csproj index 2d75ce3db68..7788ff1f39f 100644 --- a/src/System.Management.Automation/System.Management.Automation.csproj +++ b/src/System.Management.Automation/System.Management.Automation.csproj @@ -109,7 +109,6 @@ - diff --git a/src/System.Management.Automation/engine/InitialSessionState.cs b/src/System.Management.Automation/engine/InitialSessionState.cs index 8c99230c935..d4f524995dc 100644 --- a/src/System.Management.Automation/engine/InitialSessionState.cs +++ b/src/System.Management.Automation/engine/InitialSessionState.cs @@ -4599,6 +4599,8 @@ internal static SessionStateAliasEntry[] BuiltInAliases new SessionStateAliasEntry("rmdir", "Remove-Item"), new SessionStateAliasEntry("cnsn", "Connect-PSSession", string.Empty, ReadOnly), new SessionStateAliasEntry("dnsn", "Disconnect-PSSession", string.Empty, ReadOnly), + new SessionStateAliasEntry("ogv", "Out-GridView", string.Empty, ReadOnly), + new SessionStateAliasEntry("shcm", "Show-Command", string.Empty, ReadOnly), #endif // Bash built-ins we purposefully keep even if they override native commands new SessionStateAliasEntry("cd", "Set-Location", string.Empty, AllScope), @@ -4614,12 +4616,10 @@ internal static SessionStateAliasEntry[] BuiltInAliases #if !CORECLR new SessionStateAliasEntry("gwmi", "Get-WmiObject", string.Empty, ReadOnly), new SessionStateAliasEntry("iwmi", "Invoke-WMIMethod", string.Empty, ReadOnly), - new SessionStateAliasEntry("ogv", "Out-GridView", string.Empty, ReadOnly), new SessionStateAliasEntry("ise", "powershell_ise.exe", string.Empty, ReadOnly), new SessionStateAliasEntry("rwmi", "Remove-WMIObject", string.Empty, ReadOnly), new SessionStateAliasEntry("sc", "Set-Content", string.Empty, ReadOnly), new SessionStateAliasEntry("swmi", "Set-WMIInstance", string.Empty, ReadOnly), - new SessionStateAliasEntry("shcm", "Show-Command", string.Empty, ReadOnly), new SessionStateAliasEntry("trcm", "Trace-Command", string.Empty, ReadOnly), new SessionStateAliasEntry("lp", "Out-Printer"), #endif diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index ac1486d91fc..9e1be98d431 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -50,6 +50,7 @@ + From a7283b486663b567a3c0f64a7d9ab6368ea49451 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Sun, 21 Apr 2019 16:27:22 -0700 Subject: [PATCH 02/22] update copyright notice, move files to folder with namespace name not assembly name --- .../CommonHelper.cs | 0 .../HelpWindow/HelpParagraphBuilder.cs | 0 .../HelpWindow/HelpViewModel.cs | 0 .../HelpWindow/HelpWindow.xaml | 7 ++++++- .../HelpWindow/HelpWindow.xaml.cs | 0 .../HelpWindow/HelpWindowSettings.Designer.cs | 0 .../HelpWindow/HelpWindowSettings.settings | 0 .../HelpWindow/ParagraphBuilder.cs | 0 .../HelpWindow/ParagraphSearcher.cs | 0 .../HelpWindow/SettingsDialog.xaml | 7 ++++++- .../HelpWindow/SettingsDialog.xaml.cs | 0 .../ManagementList/Common/AutomationButton.cs | 0 .../ManagementList/Common/AutomationImage.cs | 0 .../ManagementList/Common/AutomationTextBlock.cs | 0 .../Common/AutomationTextBlockAutomationPeer.cs | 0 .../ManagementList/Common/BooleanBoxes.cs | 0 .../ManagementList/Common/CommandHelper.cs | 0 .../ManagementList/Common/CustomTypeComparer.cs | 0 .../ManagementList/Common/DataRoutedEventArgs.cs | 0 .../Common/DateTimeApproximationComparer.cs | 0 .../Common/DismissiblePopup.Generated.cs | 0 .../ManagementList/Common/DismissiblePopup.cs | 0 .../ExtendedFrameworkElementAutomationPeer.cs | 0 .../ManagementList/Common/IAsyncProgress.cs | 0 .../Common/IStateDescriptorFactory.cs | 0 .../ManagementList/Common/IntegralConverter.cs | 0 .../Common/InverseBooleanConverter.cs | 0 .../ManagementList/Common/IsEqualConverter.cs | 0 .../ManagementList/Common/IsNotNullConverter.cs | 0 .../ManagementList/Common/KeyboardHelp.cs | 0 .../Common/ListOrganizer.Generated.cs | 0 .../ManagementList/Common/ListOrganizer.cs | 0 .../Common/ListOrganizerItem.Generated.cs | 0 .../ManagementList/Common/ListOrganizerItem.cs | 0 .../Common/MessageTextBox.Generated.cs | 0 .../ManagementList/Common/MessageTextBox.cs | 0 .../ManagementList/Common/PickerBase.Generated.cs | 0 .../ManagementList/Common/PickerBase.cs | 0 .../Common/PopupControlButton.Generated.cs | 0 .../ManagementList/Common/PopupControlButton.cs | 0 .../Common/PropertyChangedEventArgs.cs | 0 .../Common/ReadOnlyObservableAsyncCollection.cs | 0 .../Common/ScalableImage.Generated.cs | 0 .../ManagementList/Common/ScalableImage.cs | 0 .../Common/ScalableImageSource.Generated.cs | 0 .../ManagementList/Common/ScalableImageSource.cs | 0 .../ManagementList/Common/StateDescriptor.cs | 0 .../ManagementList/Common/StringFormatConverter.cs | 0 .../Common/TextBlockService.Generated.cs | 0 .../ManagementList/Common/TextBlockService.cs | 0 .../ManagementList/Common/TextTrimConverter.cs | 0 .../ManagementList/Common/Utilities.cs | 0 .../Common/VisualToAncestorDataConverter.cs | 0 .../ManagementList/Common/WeakEventListener.cs | 0 .../ManagementList/Common/WpfHelp.cs | 0 .../CommonControls/AutomationGroup.cs | 0 .../CommonControls/ExpanderButton.Generated.cs | 0 .../CommonControls/ExpanderButton.cs | 0 .../CommonControls/ExpanderButtonAutomationPeer.cs | 0 .../CommonControls/Resizer.Generated.cs | 0 .../ManagementList/CommonControls/Resizer.cs | 0 .../ResizerGripThicknessConverter.cs | 0 .../CommonControls/UIElementAdorner.Generated.cs | 0 .../CommonControls/UIElementAdorner.cs | 0 .../DefaultFilterRuleCustomizationFactory.cs | 0 .../ManagementList/FilterCore/FilterEvaluator.cs | 0 .../FilterCore/FilterExceptionEventArgs.cs | 0 .../FilterExpressionAndOperatorNode.cs | 0 .../FilterExpressionNodes/FilterExpressionNode.cs | 0 .../FilterExpressionOperandNode.cs | 0 .../FilterExpressionOrOperatorNode.cs | 0 .../FilterCore/FilterRuleCustomizationFactory.cs | 0 .../FilterRules/ComparableValueFilterRule.cs | 0 .../FilterRules/DoesNotEqualFilterRule.cs | 0 .../FilterCore/FilterRules/EqualsFilterRule.cs | 0 .../FilterCore/FilterRules/FilterRule.cs | 0 .../FilterCore/FilterRules/FilterRuleExtensions.cs | 0 .../FilterCore/FilterRules/IsBetweenFilterRule.cs | 0 .../FilterCore/FilterRules/IsEmptyFilterRule.cs | 0 .../FilterRules/IsGreaterThanFilterRule.cs | 0 .../FilterCore/FilterRules/IsLessThanFilterRule.cs | 0 .../FilterCore/FilterRules/IsNotEmptyFilterRule.cs | 0 .../FilterRules/IsNotEmptyValidationRule.cs | 0 .../PropertiesTextContainsFilterRule.cs | 0 .../FilterRules/PropertyValueSelectorFilterRule.cs | 0 .../FilterCore/FilterRules/SelectorFilterRule.cs | 0 .../SingleValueComparableValueFilterRule.cs | 0 .../FilterRules/TextContainsFilterRule.cs | 0 .../FilterRules/TextDoesNotContainFilterRule.cs | 0 .../FilterRules/TextDoesNotEqualFilterRule.cs | 0 .../FilterRules/TextEndsWithFilterRule.cs | 0 .../FilterCore/FilterRules/TextEqualsFilterRule.cs | 0 .../FilterCore/FilterRules/TextFilterRule.cs | 0 .../FilterRules/TextStartsWithFilterRule.cs | 0 .../ManagementList/FilterCore/FilterStatus.cs | 0 .../ManagementList/FilterCore/FilterUtilities.cs | 0 .../ManagementList/FilterCore/IEvaluate.cs | 0 .../FilterCore/IFilterExpressionProvider.cs | 0 .../FilterCore/ItemsControlFilterEvaluator.cs | 0 .../FilterCore/ValidatingSelectorValue.cs | 0 .../ManagementList/FilterCore/ValidatingValue.cs | 0 .../FilterCore/ValidatingValueBase.cs | 0 .../DataErrorInfoValidationResult.cs | 0 .../ValidationRules/DataErrorInfoValidationRule.cs | 0 .../AddFilterRulePicker.Generated.cs | 0 .../FilterProviders/AddFilterRulePicker.cs | 0 .../FilterProviders/AddFilterRulePickerItem.cs | 0 .../FilterProviders/FilterRulePanel.Generated.cs | 0 .../FilterProviders/FilterRulePanel.cs | 0 .../FilterRulePanelContentPresenter.cs | 0 .../FilterProviders/FilterRulePanelController.cs | 0 .../FilterProviders/FilterRulePanelItem.cs | 0 .../FilterProviders/FilterRulePanelItemType.cs | 0 .../FilterProviders/FilterRuleTemplateSelector.cs | 0 .../FilterRuleToDisplayNameConverter.cs | 0 .../InputFieldBackgroundTextConverter.cs | 0 .../IsValidatingValueValidConverter.cs | 0 .../FilterProviders/SearchBox.Generated.cs | 0 .../ManagementList/FilterProviders/SearchBox.cs | 0 .../FilterProviders/SearchTextParseResult.cs | 0 .../FilterProviders/SearchTextParser.cs | 0 ...alidatingSelectorValueToDisplayNameConverter.cs | 0 ...lidatingValueToGenericParameterTypeConverter.cs | 0 .../ManagementList/ColumnPicker.xaml | 7 ++++++- .../ManagementList/ColumnPicker.xaml.cs | 0 .../ManagementList/DefaultStringConverter.cs | 0 .../ManagementList/IPropertyValueGetter.cs | 0 .../ManagementList/InnerList.Generated.cs | 0 .../ManagementList/InnerListColumn.Generated.cs | 0 .../ManagementList/InnerListGridView.cs | 0 .../ManagementList/ManagementList/Innerlist.cs | 0 .../ManagementList/ManagementList.Generated.cs | 0 .../ManagementListStateDescriptor.cs | 0 .../ManagementListStateDescriptorFactory.cs | 0 .../ManagementListTitle.Generated.cs | 0 .../ManagementList/ManagementListTitle.cs | 0 .../ManagementList/PropertyValueComparer.cs | 0 .../ManagementList/PropertyValueGetter.cs | 0 .../ManagementList/UIPropertyGroupDescription.cs | 0 .../ManagementList/ViewGroupToStringConverter.cs | 0 .../ManagementList/ManagementList/WaitRing.cs | 0 .../ManagementList/innerlistcolumn.cs | 0 .../ManagementList/managementlist.cs | 0 .../Microsoft.PowerShell.GraphicalHost.csproj | 0 .../ShowCommand/Controls/AllModulesControl.xaml | 7 ++++++- .../ShowCommand/Controls/AllModulesControl.xaml.cs | 0 .../ShowCommand/Controls/CmdletControl.xaml | 7 ++++++- .../ShowCommand/Controls/CmdletControl.xaml.cs | 0 .../Controls/ImageButton/ImageButton.xaml | 11 ++++++++--- .../Controls/ImageButton/ImageButton.xaml.cs | 0 .../Controls/ImageButton/ImageButtonBase.cs | 0 .../Controls/ImageButton/ImageButtonCommon.xaml | 13 +++++++++---- .../ImageButton/ImageButtonToolTipConverter.cs | 0 .../Controls/ImageButton/ImageToggleButton.xaml | 13 +++++++++---- .../Controls/ImageButton/ImageToggleButton.xaml.cs | 0 .../Controls/MultipleSelectionControl.xaml | 7 ++++++- .../Controls/MultipleSelectionControl.xaml.cs | 0 .../Controls/NotImportedCmdletControl.xaml | 7 ++++++- .../Controls/NotImportedCmdletControl.xaml.cs | 0 .../ShowCommand/Controls/ParameterSetControl.xaml | 13 +++++++++---- .../Controls/ParameterSetControl.xaml.cs | 0 .../ShowCommand/Controls/ShowModuleControl.xaml | 13 +++++++++---- .../ShowCommand/Controls/ShowModuleControl.xaml.cs | 0 .../ShowCommand/ShowCommandSettings.Designer.cs | 0 .../ShowCommand/ShowCommandSettings.settings | 0 .../ShowCommand/ViewModel/AllModulesViewModel.cs | 0 .../ShowCommand/ViewModel/CommandEventArgs.cs | 0 .../ShowCommand/ViewModel/CommandViewModel.cs | 0 .../ShowCommand/ViewModel/HelpNeededEventArgs.cs | 0 .../ShowCommand/ViewModel/ImportModuleEventArgs.cs | 0 .../ShowCommand/ViewModel/ModuleViewModel.cs | 0 .../ShowCommand/ViewModel/ParameterSetViewModel.cs | 0 .../ShowCommand/ViewModel/ParameterViewModel.cs | 0 .../Windows/MultipleSelectionDialog.xaml | 7 ++++++- .../Windows/MultipleSelectionDialog.xaml.cs | 0 .../ShowCommand/Windows/ShowAllModulesWindow.xaml | 7 ++++++- .../Windows/ShowAllModulesWindow.xaml.cs | 0 .../ShowCommand/Windows/ShowCommandWindow.xaml | 7 ++++++- .../ShowCommand/Windows/ShowCommandWindow.xaml.cs | 0 .../app.config | 0 .../commandHelpers/HelpWindowHelper.cs | 0 .../commandHelpers/OutGridView.cs | 0 .../commandHelpers/ShowCommandHelper.cs | 0 .../generic.xaml | 11 ++--------- .../resources/GraphicalHostResources.resx | 0 .../resources/Graphics/Add16.png | Bin .../resources/Graphics/CloseTile16.png | Bin .../resources/Graphics/Delete16.png | Bin .../resources/Graphics/Error16.png | Bin .../resources/Graphics/Help.ico | Bin .../resources/Graphics/Rename16.png | Bin .../resources/Graphics/Save16.png | Bin .../resources/Graphics/SortAdornerAscending.png | Bin .../resources/Graphics/SortAdornerDescending.png | Bin .../resources/Graphics/SpyGlass10.png | Bin .../resources/Graphics/SpyGlass16.png | Bin .../resources/Graphics/down.ico | Bin .../resources/HelpWindowResources.resx | 0 .../resources/InvariantResources.resx | 0 .../resources/ShowCommandResources.resx | 0 .../resources/UICultureResources.resx | 0 .../resources/XamlLocalizableResources.resx | 0 src/powershell-win-core/powershell-win-core.csproj | 2 +- 203 files changed, 107 insertions(+), 39 deletions(-) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/CommonHelper.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/HelpParagraphBuilder.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/HelpViewModel.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/HelpWindow.xaml (94%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/HelpWindow.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/HelpWindowSettings.Designer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/HelpWindowSettings.settings (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/ParagraphBuilder.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/ParagraphSearcher.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/SettingsDialog.xaml (93%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/HelpWindow/SettingsDialog.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/AutomationButton.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/AutomationImage.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/AutomationTextBlock.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/AutomationTextBlockAutomationPeer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/BooleanBoxes.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/CommandHelper.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/CustomTypeComparer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/DataRoutedEventArgs.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/DateTimeApproximationComparer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/DismissiblePopup.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/DismissiblePopup.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ExtendedFrameworkElementAutomationPeer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/IAsyncProgress.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/IStateDescriptorFactory.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/IntegralConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/InverseBooleanConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/IsEqualConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/IsNotNullConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/KeyboardHelp.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ListOrganizer.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ListOrganizer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ListOrganizerItem.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ListOrganizerItem.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/MessageTextBox.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/MessageTextBox.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/PickerBase.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/PickerBase.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/PopupControlButton.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/PopupControlButton.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/PropertyChangedEventArgs.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ReadOnlyObservableAsyncCollection.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ScalableImage.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ScalableImage.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ScalableImageSource.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/ScalableImageSource.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/StateDescriptor.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/StringFormatConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/TextBlockService.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/TextBlockService.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/TextTrimConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/Utilities.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/VisualToAncestorDataConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/WeakEventListener.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/Common/WpfHelp.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/CommonControls/AutomationGroup.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/CommonControls/ExpanderButton.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/CommonControls/ExpanderButton.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/CommonControls/ExpanderButtonAutomationPeer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/CommonControls/Resizer.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/CommonControls/Resizer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/CommonControls/ResizerGripThicknessConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/CommonControls/UIElementAdorner.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/CommonControls/UIElementAdorner.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterEvaluator.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterExceptionEventArgs.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionNode.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/FilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/TextFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterStatus.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/FilterUtilities.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/IEvaluate.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/IFilterExpressionProvider.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/ValidatingSelectorValue.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/ValidatingValue.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/ValidatingValueBase.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/AddFilterRulePicker.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/AddFilterRulePicker.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/AddFilterRulePickerItem.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/FilterRulePanel.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/FilterRulePanel.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/FilterRulePanelController.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/FilterRulePanelItem.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/FilterRulePanelItemType.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/SearchBox.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/SearchBox.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/SearchTextParseResult.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/SearchTextParser.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/ColumnPicker.xaml (97%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/ColumnPicker.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/DefaultStringConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/IPropertyValueGetter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/InnerList.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/InnerListColumn.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/InnerListGridView.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/Innerlist.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/ManagementList.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/ManagementListStateDescriptor.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/ManagementListStateDescriptorFactory.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/ManagementListTitle.Generated.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/ManagementListTitle.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/PropertyValueComparer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/PropertyValueGetter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/UIPropertyGroupDescription.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/ViewGroupToStringConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/WaitRing.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/innerlistcolumn.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ManagementList/ManagementList/managementlist.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/Microsoft.PowerShell.GraphicalHost.csproj (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/AllModulesControl.xaml (91%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/AllModulesControl.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/CmdletControl.xaml (93%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/CmdletControl.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ImageButton/ImageButton.xaml (74%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ImageButton/ImageButtonBase.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml (97%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml (77%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/MultipleSelectionControl.xaml (79%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/MultipleSelectionControl.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/NotImportedCmdletControl.xaml (81%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/NotImportedCmdletControl.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ParameterSetControl.xaml (70%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ParameterSetControl.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ShowModuleControl.xaml (81%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Controls/ShowModuleControl.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ShowCommandSettings.Designer.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ShowCommandSettings.settings (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ViewModel/AllModulesViewModel.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ViewModel/CommandEventArgs.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ViewModel/CommandViewModel.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ViewModel/HelpNeededEventArgs.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ViewModel/ImportModuleEventArgs.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ViewModel/ModuleViewModel.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ViewModel/ParameterSetViewModel.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/ViewModel/ParameterViewModel.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Windows/MultipleSelectionDialog.xaml (84%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Windows/MultipleSelectionDialog.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Windows/ShowAllModulesWindow.xaml (86%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Windows/ShowCommandWindow.xaml (85%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/ShowCommand/Windows/ShowCommandWindow.xaml.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/app.config (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/commandHelpers/HelpWindowHelper.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/commandHelpers/OutGridView.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/commandHelpers/ShowCommandHelper.cs (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/generic.xaml (99%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/GraphicalHostResources.resx (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/Add16.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/CloseTile16.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/Delete16.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/Error16.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/Help.ico (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/Rename16.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/Save16.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/SortAdornerAscending.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/SortAdornerDescending.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/SpyGlass10.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/SpyGlass16.png (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/Graphics/down.ico (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/HelpWindowResources.resx (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/InvariantResources.resx (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/ShowCommandResources.resx (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/UICultureResources.resx (100%) rename src/{Microsoft.PowerShell.GraphicalHost => Microsoft.Management.UI.Internal}/resources/XamlLocalizableResources.resx (100%) diff --git a/src/Microsoft.PowerShell.GraphicalHost/CommonHelper.cs b/src/Microsoft.Management.UI.Internal/CommonHelper.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/CommonHelper.cs rename to src/Microsoft.Management.UI.Internal/CommonHelper.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpParagraphBuilder.cs rename to src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpViewModel.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpViewModel.cs rename to src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml similarity index 94% rename from src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml rename to src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml index 48b2e412d67..b30ddfdbbfe 100644 --- a/src/Microsoft.PowerShell.GraphicalHost/HelpWindow/HelpWindow.xaml +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml @@ -1,4 +1,9 @@ - + + + + + + + + + + + + @@ -11,8 +16,8 @@ - diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonBase.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonBase.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonBase.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonBase.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml similarity index 97% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml index 1c3a35abdde..f8ce60e8418 100644 --- a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonCommon.xaml @@ -1,4 +1,9 @@ - + + - - + + @@ -121,4 +126,4 @@ - \ No newline at end of file + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml similarity index 77% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml index 5d8a7e8dbd0..720e4782d1a 100644 --- a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml @@ -1,4 +1,9 @@ - + + @@ -11,10 +16,10 @@ - diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml similarity index 79% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml index a55eaa85766..671f1bc8f99 100644 --- a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/MultipleSelectionControl.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml @@ -1,4 +1,9 @@ - + + + + + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ParameterSetControl.xaml.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml similarity index 81% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml index b622c1a5d27..932dbbe885e 100644 --- a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml @@ -1,10 +1,15 @@ - + + diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Controls/ShowModuleControl.xaml.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.Designer.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.Designer.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.settings b/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.settings similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ShowCommandSettings.settings rename to src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.settings diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/AllModulesViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/AllModulesViewModel.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandEventArgs.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandEventArgs.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandEventArgs.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandEventArgs.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/CommandViewModel.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/HelpNeededEventArgs.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/HelpNeededEventArgs.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/HelpNeededEventArgs.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/HelpNeededEventArgs.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ImportModuleEventArgs.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ImportModuleEventArgs.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ImportModuleEventArgs.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ImportModuleEventArgs.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ModuleViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ModuleViewModel.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterSetViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterSetViewModel.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs similarity index 100% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/ViewModel/ParameterViewModel.cs rename to src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs diff --git a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml similarity index 84% rename from src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml rename to src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml index feb46a749b6..5082ba03fbd 100644 --- a/src/Microsoft.PowerShell.GraphicalHost/ShowCommand/Windows/MultipleSelectionDialog.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml @@ -1,4 +1,9 @@ - + + + + + + - + From bbdf1eb49090182017e11c695c822beda7e39c36 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Mon, 22 Apr 2019 15:40:21 -0700 Subject: [PATCH 03/22] fix path names to resources --- .../HelpWindow/SettingsDialog.xaml.cs | 10 ++------ .../Microsoft.PowerShell.GraphicalHost.csproj | 24 +++++++++---------- .../Controls/ImageButton/ImageButton.xaml | 2 +- .../ImageButton/ImageToggleButton.xaml | 2 +- .../{ => themes}/generic.xaml | 1 - 5 files changed, 16 insertions(+), 23 deletions(-) rename src/Microsoft.Management.UI.Internal/{ => themes}/generic.xaml (99%) diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/SettingsDialog.xaml.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/SettingsDialog.xaml.cs index 538540bd575..e6cca8ff1f1 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/SettingsDialog.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/SettingsDialog.xaml.cs @@ -1,11 +1,5 @@ -//----------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// -// Implements SettingsDialog. -// -//----------------------------------------------------------------------- +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. namespace Microsoft.Management.UI { diff --git a/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj b/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj index cd78d520f69..f69ecd824fa 100644 --- a/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj +++ b/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj @@ -13,18 +13,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml index 8c0e74630bf..95cfc771893 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml @@ -11,7 +11,7 @@ - + diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml index 720e4782d1a..2b93aa1dc40 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml @@ -11,7 +11,7 @@ - + diff --git a/src/Microsoft.Management.UI.Internal/generic.xaml b/src/Microsoft.Management.UI.Internal/themes/generic.xaml similarity index 99% rename from src/Microsoft.Management.UI.Internal/generic.xaml rename to src/Microsoft.Management.UI.Internal/themes/generic.xaml index c2a33b43211..fbb2aaa8407 100644 --- a/src/Microsoft.Management.UI.Internal/generic.xaml +++ b/src/Microsoft.Management.UI.Internal/themes/generic.xaml @@ -13,7 +13,6 @@ xmlns:aerotheme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" xmlns:classictheme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"> - M 0,0 L 4,3.5 L 0,7 Z M7.3391155,8.3084572 L7.3391708,16.109179 10.974259,12.431834 z From 2f10f5e0eb8d3843bed46e3f29cd2c30d70caf29 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Tue, 23 Apr 2019 17:08:37 -0700 Subject: [PATCH 04/22] enable generation of public resources needed by show-command update resource namespaces to match --- .../Microsoft.PowerShell.GraphicalHost.csproj | 24 ++++++++-------- .../ShowCommand/Controls/CmdletControl.xaml | 3 +- .../Controls/ImageButton/ImageButton.xaml | 2 +- .../ImageButton/ImageToggleButton.xaml | 2 +- .../Controls/MultipleSelectionControl.xaml | 2 +- .../Controls/NotImportedCmdletControl.xaml | 2 +- .../Windows/MultipleSelectionDialog.xaml | 1 - .../Windows/ShowAllModulesWindow.xaml | 2 +- .../Windows/ShowCommandWindow.xaml | 2 +- ...esx => public.GraphicalHostResources.resx} | 0 ...s.resx => public.HelpWindowResources.resx} | 0 ...es.resx => public.InvariantResources.resx} | 0 ....resx => public.ShowCommandResources.resx} | 0 ...es.resx => public.UICultureResources.resx} | 0 ...x => public.XamlLocalizableResources.resx} | 0 .../themes/generic.xaml | 22 +++++++-------- src/ResGen/Program.cs | 28 ++++++++++++------- 17 files changed, 48 insertions(+), 42 deletions(-) rename src/Microsoft.Management.UI.Internal/resources/{GraphicalHostResources.resx => public.GraphicalHostResources.resx} (100%) rename src/Microsoft.Management.UI.Internal/resources/{HelpWindowResources.resx => public.HelpWindowResources.resx} (100%) rename src/Microsoft.Management.UI.Internal/resources/{InvariantResources.resx => public.InvariantResources.resx} (100%) rename src/Microsoft.Management.UI.Internal/resources/{ShowCommandResources.resx => public.ShowCommandResources.resx} (100%) rename src/Microsoft.Management.UI.Internal/resources/{UICultureResources.resx => public.UICultureResources.resx} (100%) rename src/Microsoft.Management.UI.Internal/resources/{XamlLocalizableResources.resx => public.XamlLocalizableResources.resx} (100%) diff --git a/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj b/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj index f69ecd824fa..01049440a64 100644 --- a/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj +++ b/src/Microsoft.Management.UI.Internal/Microsoft.PowerShell.GraphicalHost.csproj @@ -13,18 +13,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/CmdletControl.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/CmdletControl.xaml index 463f2c20dda..77a60961484 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/CmdletControl.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/CmdletControl.xaml @@ -9,7 +9,6 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:ch="clr-namespace:Microsoft.PowerShell.Commands.ShowCommandInternal" - xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal" xmlns:default="clr-namespace:" xmlns:controls="clr-namespace:Microsoft.PowerShell.Commands.ShowCommandInternal" mc:Ignorable="d" @@ -27,7 +26,7 @@ - + diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml index 95cfc771893..18cc35d0fec 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml @@ -11,7 +11,7 @@ - + diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml index 2b93aa1dc40..347331124f3 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml @@ -11,7 +11,7 @@ - + diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml index 671f1bc8f99..9070f9bc78a 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml @@ -8,7 +8,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal" + xmlns:sc="clr-namespace:Microsoft.PowerShell.Commands.ShowCommandInternal" xmlns:default="clr-namespace:" mc:Ignorable="d"> diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/NotImportedCmdletControl.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/NotImportedCmdletControl.xaml index 9b29f65addc..8743d95e74a 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/NotImportedCmdletControl.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/NotImportedCmdletControl.xaml @@ -9,8 +9,8 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:this="clr-namespace:Microsoft.PowerShell.Commands.ShowCommandInternal" - xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal" xmlns:default="clr-namespace:" + xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal" FocusManager.FocusedElement="{Binding ElementName=CommandName}" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"> diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml index 5082ba03fbd..0a6a3b72762 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml @@ -8,7 +8,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal" xmlns:default="clr-namespace:" mc:Ignorable="d" Title="MemberType" Height="200" Width="404" WindowStartupLocation="CenterScreen"> diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml index bebd076d890..2f21faeef22 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml @@ -7,8 +7,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:this="clr-namespace:Microsoft.PowerShell.Commands.ShowCommandInternal" - xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal" xmlns:default="clr-namespace:" + xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal" MinWidth="300" MinHeight="300" Title="Commands" Width="380" Height="600"> diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowCommandWindow.xaml b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowCommandWindow.xaml index c8b1e84f0e9..d373f52a985 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowCommandWindow.xaml +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowCommandWindow.xaml @@ -7,8 +7,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:this="clr-namespace:Microsoft.PowerShell.Commands.ShowCommandInternal" - xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal" xmlns:default="clr-namespace:" + xmlns:sc="clr-namespace:Microsoft.Management.UI.Internal" MinWidth="300" MinHeight="300" Title="{Binding Name}" Width="380" Height="450"> diff --git a/src/Microsoft.Management.UI.Internal/resources/GraphicalHostResources.resx b/src/Microsoft.Management.UI.Internal/resources/public.GraphicalHostResources.resx similarity index 100% rename from src/Microsoft.Management.UI.Internal/resources/GraphicalHostResources.resx rename to src/Microsoft.Management.UI.Internal/resources/public.GraphicalHostResources.resx diff --git a/src/Microsoft.Management.UI.Internal/resources/HelpWindowResources.resx b/src/Microsoft.Management.UI.Internal/resources/public.HelpWindowResources.resx similarity index 100% rename from src/Microsoft.Management.UI.Internal/resources/HelpWindowResources.resx rename to src/Microsoft.Management.UI.Internal/resources/public.HelpWindowResources.resx diff --git a/src/Microsoft.Management.UI.Internal/resources/InvariantResources.resx b/src/Microsoft.Management.UI.Internal/resources/public.InvariantResources.resx similarity index 100% rename from src/Microsoft.Management.UI.Internal/resources/InvariantResources.resx rename to src/Microsoft.Management.UI.Internal/resources/public.InvariantResources.resx diff --git a/src/Microsoft.Management.UI.Internal/resources/ShowCommandResources.resx b/src/Microsoft.Management.UI.Internal/resources/public.ShowCommandResources.resx similarity index 100% rename from src/Microsoft.Management.UI.Internal/resources/ShowCommandResources.resx rename to src/Microsoft.Management.UI.Internal/resources/public.ShowCommandResources.resx diff --git a/src/Microsoft.Management.UI.Internal/resources/UICultureResources.resx b/src/Microsoft.Management.UI.Internal/resources/public.UICultureResources.resx similarity index 100% rename from src/Microsoft.Management.UI.Internal/resources/UICultureResources.resx rename to src/Microsoft.Management.UI.Internal/resources/public.UICultureResources.resx diff --git a/src/Microsoft.Management.UI.Internal/resources/XamlLocalizableResources.resx b/src/Microsoft.Management.UI.Internal/resources/public.XamlLocalizableResources.resx similarity index 100% rename from src/Microsoft.Management.UI.Internal/resources/XamlLocalizableResources.resx rename to src/Microsoft.Management.UI.Internal/resources/public.XamlLocalizableResources.resx diff --git a/src/Microsoft.Management.UI.Internal/themes/generic.xaml b/src/Microsoft.Management.UI.Internal/themes/generic.xaml index fbb2aaa8407..eb7a3504dce 100644 --- a/src/Microsoft.Management.UI.Internal/themes/generic.xaml +++ b/src/Microsoft.Management.UI.Internal/themes/generic.xaml @@ -381,7 +381,7 @@ - @@ -915,7 +915,7 @@ Height="18"> - @@ -999,7 +999,7 @@ Stretch="None" Width="16" Height="16" - Source="pack://application:,,,/Microsoft.Powershell.GraphicalHost;component/Error16.png" /> + Source="pack://application:,,,/Microsoft.Powershell.GraphicalHost;component/resources/Graphics/Error16.png" /> + Image="pack://application:,,,/Microsoft.Powershell.GraphicalHost;component/resources/Graphics/Delete16.png" /> @@ -1462,7 +1462,7 @@ + Image="pack://application:,,,/Microsoft.Powershell.GraphicalHost;component/resources/Graphics/Rename16.png" /> @@ -1739,7 +1739,7 @@ - + @@ -1763,7 +1763,7 @@ - + @@ -1787,7 +1787,7 @@ - + @@ -1833,7 +1833,7 @@ - + @@ -2575,7 +2575,7 @@ @@ -2632,7 +2632,7 @@ diff --git a/src/ResGen/Program.cs b/src/ResGen/Program.cs index 0a0f21aaa08..8ae3d09937c 100644 --- a/src/ResGen/Program.cs +++ b/src/ResGen/Program.cs @@ -47,8 +47,15 @@ public static void Main(string[] args) foreach (string resxPath in Directory.EnumerateFiles(resourcePath, fileFilter)) { + string accessModifier = "internal"; string className = Path.GetFileNameWithoutExtension(resxPath); - string sourceCode = GetStronglyTypeCsFileForResx(resxPath, moduleName, className); + if (className.StartsWith("public.", StringComparison.InvariantCultureIgnoreCase)) + { + accessModifier = "public"; + className = className.Substring(className.IndexOf(".")+1); + } + + string sourceCode = GetStronglyTypeCsFileForResx(resxPath, moduleName, className, accessModifier); string outPath = Path.Combine(genFolder, className + ".cs"); Console.WriteLine("ResGen for " + outPath); File.WriteAllText(outPath, sourceCode); @@ -57,7 +64,7 @@ public static void Main(string[] args) } } - private static string GetStronglyTypeCsFileForResx(string xmlPath, string moduleName, string className) + private static string GetStronglyTypeCsFileForResx(string xmlPath, string moduleName, string className, string accessModifier) { // Example // @@ -80,10 +87,10 @@ private static string GetStronglyTypeCsFileForResx(string xmlPath, string module { string value = data.Value.Replace("\n", "\n ///"); string name = data.Attribute("name").Value.Replace(' ', '_'); - entries.AppendFormat(ENTRY, name, value); + entries.AppendFormat(ENTRY, name, value, accessModifier); } - string bodyCode = string.Format(BODY, shortClassName, moduleName, entries.ToString(), className); + string bodyCode = string.Format(BODY, shortClassName, moduleName, entries.ToString(), className, accessModifier, accessModifier.Equals("public", StringComparison.InvariantCultureIgnoreCase) ? "public." : ""); if (namespaceName != null) { bodyCode = string.Format(NAMESPACE, namespaceName, bodyCode); @@ -123,24 +130,25 @@ namespace {0} {{ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] -internal class {0} {{ +{4} class {0} {{ private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; + /// constructor [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(""Microsoft.Performance"", ""CA1811:AvoidUncalledPrivateCode"")] - internal {0}() {{ + {4} {0}() {{ }} /// /// Returns the cached ResourceManager instance used by this class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager {{ + {4} static global::System.Resources.ResourceManager ResourceManager {{ get {{ if (object.ReferenceEquals(resourceMan, null)) {{ - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(""{1}.resources.{3}"", typeof({0}).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(""{1}.resources.{5}{3}"", typeof({0}).Assembly); resourceMan = temp; }} @@ -153,7 +161,7 @@ internal class {0} {{ /// resource lookups using this strongly typed resource class. /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture {{ + {4} static global::System.Globalization.CultureInfo Culture {{ get {{ return resourceCulture; }} @@ -171,7 +179,7 @@ internal class {0} {{ /// /// Looks up a localized string similar to {1} /// - internal static string {0} {{ + {2} static string {0} {{ get {{ return ResourceManager.GetString(""{0}"", resourceCulture); }} From 710918a61c01392fb441912280823988efb021e3 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Tue, 23 Apr 2019 19:13:08 -0700 Subject: [PATCH 05/22] remove timeout for ogv window suppress newline for show-command output as it doesn't work with psreadline --- .../commandHelpers/OutGridView.cs | 6 +----- .../commands/utility/ShowCommand/ShowCommand.cs | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs index d9f89cf8622..47534883012 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs @@ -402,11 +402,7 @@ private void AddColumns(string[] propertyNames, string[] displayNames, Type[] ty // Wait for the gridViewWindow thread to signal that loading of Window is done if (this.gridViewWindowLoaded != null) { - if(!this.gridViewWindowLoaded.WaitOne(5000)) - { - throw new Exception("The window didn't open in time"); - } - + this.gridViewWindowLoaded.WaitOne(); this.gridViewWindowLoaded = null; } diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs index 92c73063135..a10dfa7b892 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs @@ -156,7 +156,8 @@ public void RunScript(string script) return; } - if (!ConsoleInputWithNativeMethods.AddToConsoleInputBuffer(script, true)) + // Don't send newline at end as PSReadLine shows it rather than executing + if (!ConsoleInputWithNativeMethods.AddToConsoleInputBuffer(script, newLine: false)) { this.WriteDebug(FormatAndOut_out_gridview.CannotWriteToConsoleInputBuffer); this.RunScriptSilentlyAndWithErrorHookup(script); From ed9ff12369001a0a14a635e0bf7497dfe159c53c Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Tue, 23 Apr 2019 20:42:29 -0700 Subject: [PATCH 06/22] fix some style issues --- .../HelpWindow/HelpParagraphBuilder.cs | 43 +++++++++++++------ .../HelpWindow/HelpViewModel.cs | 6 +-- .../HelpWindow/HelpWindow.xaml.cs | 30 +++++++++---- .../HelpWindow/ParagraphBuilder.cs | 26 +++++------ 4 files changed, 67 insertions(+), 38 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs index 98eb8f99e75..788954f43ff 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs @@ -23,12 +23,12 @@ internal class HelpParagraphBuilder : ParagraphBuilder /// /// new line separators /// - private static readonly string[] Separators = new string[] { "\r\n", "\n" }; + private static readonly string[] Separators = new [] { "\r\n", "\n" }; /// /// Object with the cmdelt /// - private PSObject psObj; + private readonly PSObject psObj; /// /// Initializes a new instance of the HelpParagraphBuilder class @@ -186,6 +186,7 @@ private static object GetPropertyObject(PSObject psObj, string propertyName) } catch (ExtendedTypeSystemException) { + // ignore this exception } return value; @@ -261,7 +262,7 @@ private static string AddIndent(string str, string indentString) { if (str == null) { - return String.Empty; + return string.Empty; } string[] lines = str.Split(Separators, StringSplitOptions.None); @@ -298,15 +299,10 @@ private static object[] GetPropertyObjectArray(PSObject obj, string propertyName if (innerObject is PSObject) { - return new object[] { innerObject }; + return new [] { innerObject }; } object[] innerObjectArray = innerObject as object[]; - if (innerObject == null) - { - return null; - } - return innerObjectArray; } @@ -389,13 +385,14 @@ private void AddSyntax(bool setting, string sectionTitle) continue; } - string parameterType = parameterValue == null ? String.Empty : String.Format(CultureInfo.CurrentCulture, "<{0}>", parameterValue); + string parameterType = parameterValue == null ? string.Empty : String.Format(CultureInfo.CurrentCulture, "<{0}>", parameterValue); string parameterOptionalOpenBrace, parameterOptionalCloseBrace; if (String.Equals(required, "true", StringComparison.OrdinalIgnoreCase)) { - parameterOptionalOpenBrace = parameterOptionalCloseBrace = String.Empty; + parameterOptionalOpenBrace = string.Empty; + parameterOptionalCloseBrace = string.Empty; } else { @@ -407,7 +404,7 @@ private void AddSyntax(bool setting, string sectionTitle) if (String.Equals(position, "named", StringComparison.OrdinalIgnoreCase)) { - parameterNameOptionalOpenBrace = parameterNameOptionalCloseBrace = String.Empty; + parameterNameOptionalOpenBrace = parameterNameOptionalCloseBrace = string.Empty; } else { @@ -558,16 +555,22 @@ private void AddExamples(bool setting, string sectionTitle) private void AddMembers(bool setting, string sectionTitle) { if(!setting || String.IsNullOrEmpty(sectionTitle)) + { return; + } PSObject memberRootObject = HelpParagraphBuilder.GetPropertyObject(this.psObj, "Members") as PSObject; if (memberRootObject == null) + { return; + } object[] memberObjects = HelpParagraphBuilder.GetPropertyObjectArray(memberRootObject, "member"); if (memberObjects == null) + { return; + } this.AddText(sectionTitle, true); this.AddText("\r\n", false); @@ -579,7 +582,9 @@ private void AddMembers(bool setting, string sectionTitle) PSObject member = memberObj as PSObject; if (member == null) + { continue; + } string name = GetPropertyString(member, "title"); string type = GetPropertyString(member, "type"); @@ -622,7 +627,7 @@ private void AddMembers(bool setting, string sectionTitle) } } - private void FormatMethodData(PSObject member, string name, out string memberText, out string description) + private static void FormatMethodData(PSObject member, string name, out string memberText, out string description) { memberText = null; description = null; @@ -641,7 +646,9 @@ private void FormatMethodData(PSObject member, string name, out string memberTex { PSObject returnTypeData = HelpParagraphBuilder.GetPropertyObject(returnTypeObject, "type") as PSObject; if (returnTypeData != null) + { returnType = GetPropertyString(returnTypeData, "name"); + } } //Get method description. @@ -654,7 +661,9 @@ private void FormatMethodData(PSObject member, string name, out string memberTex //If we get an text we do not need to iterate more. if (!String.IsNullOrEmpty(description)) + { break; + } } } @@ -679,7 +688,9 @@ private void FormatMethodData(PSObject member, string name, out string memberTex //If there is no type for the paramter, we expect it is System.Object if (String.IsNullOrEmpty(parameterType)) + { parameterType = "object"; + } } string paramString = String.Format(CultureInfo.CurrentCulture, "[{0}] ${1},", parameterType, parameterName); @@ -694,7 +705,7 @@ private void FormatMethodData(PSObject member, string name, out string memberTex } } - memberText = String.Format(CultureInfo.CurrentCulture, " [{0}] {1}({2})\r\n", returnType, name, parameterText.ToString()); + memberText = String.Format(CultureInfo.CurrentCulture, " [{0}] {1}({2})\r\n", returnType, name, parameterText); } /// @@ -758,9 +769,13 @@ private void AddParameters(bool setting, string sectionTitle, string paramProper // This syntax string is not localized if (helpCategory == HelpCategory.DscResource) + { this.AddText(HelpParagraphBuilder.AddIndent(""), false); + } else + { this.AddText(HelpParagraphBuilder.AddIndent("-"), false); + } this.AddText(name, true); string parameterText = String.Format( diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs index ed7abab54f8..96b34812598 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs @@ -21,17 +21,17 @@ internal class HelpViewModel : INotifyPropertyChanged /// /// The builder for the help FlowDocument Paragraph used in a RichEditText control /// - private HelpParagraphBuilder helpBuilder; + private readonly HelpParagraphBuilder helpBuilder; /// /// Searcher for selecting current matches in paragraph text /// - private ParagraphSearcher searcher; + private readonly ParagraphSearcher searcher; /// /// Title of the help window /// - private string helpTitle; + private readonly string helpTitle; /// /// the zoom bound to the zoom slider value diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml.cs index 95f10f2b823..c6d65e1d232 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml.cs @@ -19,22 +19,40 @@ public partial class HelpWindow : Window /// /// Minimum zoom in the slider /// - public const double MinimumZoom = 20; + public static double MinimumZoom + { + get + { + return 20; + } + } /// /// Maximum zoom in the slider /// - public const double MaximumZoom = 300; + public static double MaximumZoom + { + get + { + return 300; + } + } /// /// Zoom interval /// - public const double ZoomInterval = 10; + public static double ZoomInterval + { + get + { + return 10; + } + } /// /// The ViewModel for the dialog /// - private HelpViewModel viewModel; + private readonly HelpViewModel viewModel; /// /// Initializes a new instance of the HelpWindow class @@ -129,10 +147,6 @@ protected override void OnPreviewKeyDown(KeyEventArgs e) if (Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift)) { this.HandleZoomInAndZoomOut(e); - if (e.Handled) - { - return; - } } } diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs index 3bb9cf7c83c..8a183cf32ec 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs @@ -20,22 +20,22 @@ internal class ParagraphBuilder : INotifyPropertyChanged /// /// The text spans that should be bold /// - private List boldSpans; + private readonly List boldSpans; /// /// The text spans that should be highlighted /// - private List highlighedSpans; + private readonly List highlightedSpans; /// /// The text displayed /// - private StringBuilder textBuilder; + private readonly StringBuilder textBuilder; /// /// Paragraph built in BuildParagraph /// - private Paragraph paragraph; + private readonly Paragraph paragraph; /// /// Initializes a new instance of the ParagraphBuilder class @@ -50,7 +50,7 @@ internal ParagraphBuilder(Paragraph paragraph) this.paragraph = paragraph; this.boldSpans = new List(); - this.highlighedSpans = new List(); + this.highlightedSpans = new List(); this.textBuilder = new StringBuilder(); } @@ -66,7 +66,7 @@ internal ParagraphBuilder(Paragraph paragraph) /// internal int HighlightCount { - get { return this.highlighedSpans.Count; } + get { return this.highlightedSpans.Count; } } /// @@ -94,7 +94,7 @@ internal void BuildParagraph() int currentBoldIndex = 0; TextSpan? currentBoldSpan = this.boldSpans.Count == 0 ? (TextSpan?)null : this.boldSpans[0]; int currentHighlightedIndex = 0; - TextSpan? currentHighlightedSpan = this.highlighedSpans.Count == 0 ? (TextSpan?)null : this.highlighedSpans[0]; + TextSpan? currentHighlightedSpan = this.highlightedSpans.Count == 0 ? (TextSpan?)null : this.highlightedSpans[0]; bool currentBold = false; bool currentHighlighted = false; @@ -109,7 +109,7 @@ internal void BuildParagraph() ParagraphBuilder.MoveSpanToPosition(ref currentBoldIndex, ref currentBoldSpan, i, this.boldSpans); newBold = currentBoldSpan == null ? false : currentBoldSpan.Value.Contains(i); - ParagraphBuilder.MoveSpanToPosition(ref currentHighlightedIndex, ref currentHighlightedSpan, i, this.highlighedSpans); + ParagraphBuilder.MoveSpanToPosition(ref currentHighlightedIndex, ref currentHighlightedSpan, i, this.highlightedSpans); newHighlighted = currentHighlightedSpan == null ? false : currentHighlightedSpan.Value.Contains(i); if (newBold != currentBold || newHighlighted != currentHighlighted) @@ -136,7 +136,7 @@ internal void BuildParagraph() /// true if we should search whole word only internal void HighlightAllInstancesOf(string search, bool caseSensitive, bool wholeWord) { - this.highlighedSpans.Clear(); + this.highlightedSpans.Clear(); if (search == null || search.Trim().Length == 0) { @@ -210,7 +210,7 @@ internal void AddText(string str, bool bold) internal void ResetAllText() { this.boldSpans.Clear(); - this.highlighedSpans.Clear(); + this.highlightedSpans.Clear(); this.textBuilder.Clear(); } @@ -292,7 +292,7 @@ private void AddHighlight(int start, int length) throw new ArgumentOutOfRangeException("length"); } - this.highlighedSpans.Add(new TextSpan(start, length)); + this.highlightedSpans.Add(new TextSpan(start, length)); } /// @@ -316,12 +316,12 @@ internal struct TextSpan /// /// Index of the first character in the span /// - private int start; + private readonly int start; /// /// Index of the last character in the span /// - private int end; + private readonly int end; /// /// Initializes a new instance of the TextSpan struct From a457c4f0e78eb79f5b1dfbe332fe5f065c5bae13 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Sat, 3 Aug 2019 17:14:11 -0700 Subject: [PATCH 07/22] remove reference to workflow --- .../ShowCommand/ViewModel/CommandViewModel.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs index 528e0e822c4..834eb5fd1c1 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs @@ -502,8 +502,6 @@ internal static CommandViewModel GetCommandViewModel(ModuleViewModel module, Sho Dictionary commonParametersTable = new Dictionary(); - bool isWorkflow = (commandInfo.CommandType & CommandTypes.Workflow) != 0; - foreach (ShowCommandParameterSetInfo parameterSetInfo in commandInfo.ParameterSets) { if (parameterSetInfo.IsDefault) From e559a8c92eb97aac17a1aec01101cbfb4df76df6 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Fri, 25 Oct 2019 13:17:13 -0700 Subject: [PATCH 08/22] add attribute indicating where the resource dictionary is located --- src/Microsoft.Management.UI.Internal/CommonHelper.cs | 3 +++ src/Microsoft.Management.UI.Internal/themes/generic.xaml | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.Management.UI.Internal/CommonHelper.cs b/src/Microsoft.Management.UI.Internal/CommonHelper.cs index f0182c7ff60..59962734720 100644 --- a/src/Microsoft.Management.UI.Internal/CommonHelper.cs +++ b/src/Microsoft.Management.UI.Internal/CommonHelper.cs @@ -3,6 +3,9 @@ using System.Windows; +// Specifies the location in which theme dictionaries are stored for types in an assembly. +[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] + namespace Microsoft.Management.UI { /// diff --git a/src/Microsoft.Management.UI.Internal/themes/generic.xaml b/src/Microsoft.Management.UI.Internal/themes/generic.xaml index eb7a3504dce..2a16a1d87cc 100644 --- a/src/Microsoft.Management.UI.Internal/themes/generic.xaml +++ b/src/Microsoft.Management.UI.Internal/themes/generic.xaml @@ -2788,4 +2788,3 @@ - From b61795cd850233406c1bca2868254b28b54936f8 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Fri, 25 Oct 2019 15:33:53 -0700 Subject: [PATCH 09/22] fix show-command by removing workflow type and added back -showwindow to helpcommand --- .../commandHelpers/ShowCommandHelper.cs | 2 +- .../common/FormatViewManager.cs | 2 +- .../help/HelpCommands.cs | 37 +++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs index 88752da8766..1793dee45e2 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs @@ -27,7 +27,7 @@ internal class ShowCommandHelper : IDisposable { #region fields - internal const string CommandTypeSegment = " -CommandType Cmdlet, Function, Script, ExternalScript, Workflow"; + internal const string CommandTypeSegment = " -CommandType Cmdlet, Function, Script, ExternalScript"; /// /// Method that will return the dialog from ShowAllModulesWindow or ShowCommandWindow. diff --git a/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs b/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs index c01ce96a4c4..49425d7854d 100644 --- a/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs +++ b/src/System.Management.Automation/FormatAndOutput/common/FormatViewManager.cs @@ -476,7 +476,7 @@ private static bool IsNotRemotingProperty(string name) private static readonly MemberNamePredicate NameIsNotRemotingProperty = IsNotRemotingProperty; - private static bool HasNonRemotingProperties(PSObject so) => so.GetFirstPropertyOrDefault(NameIsNotRemotingProperty) != null; + internal static bool HasNonRemotingProperties(PSObject so) => so.GetFirstPropertyOrDefault(NameIsNotRemotingProperty) != null; internal static FormatEntryData GenerateOutOfBandData(TerminatingErrorContext errorContext, PSPropertyExpressionFactory expressionFactory, TypeInfoDataBase db, PSObject so, int enumerationLimit, bool useToStringFallback, out List errors) diff --git a/src/System.Management.Automation/help/HelpCommands.cs b/src/System.Management.Automation/help/HelpCommands.cs index 838676f41ce..ee7af8d412f 100644 --- a/src/System.Management.Automation/help/HelpCommands.cs +++ b/src/System.Management.Automation/help/HelpCommands.cs @@ -202,6 +202,31 @@ public SwitchParameter Online private bool _showOnlineHelp; +#if !UNIX + private GraphicalHostReflectionWrapper graphicalHostReflectionWrapper; + private bool showWindow; + /// + /// Gets and sets a value indicating whether the help should be displayed in a separate window + /// + [Parameter(ParameterSetName = "ShowWindow", Mandatory = true)] + public SwitchParameter ShowWindow + { + get + { + return showWindow; + } + + set + { + showWindow = value; + if (showWindow) + { + VerifyParameterForbiddenInRemoteRunspace(this, "ShowWindow"); + } + } + } +#endif + // The following variable controls the view. private HelpView _viewTokenToAdd = HelpView.Default; @@ -243,6 +268,12 @@ protected override void ProcessRecord() HelpSystem helpSystem = this.Context.HelpSystem; try { +#if !UNIX + if(this.ShowWindow) + { + this.graphicalHostReflectionWrapper = GraphicalHostReflectionWrapper.GetGraphicalHostReflectionWrapper(this, "Microsoft.PowerShell.Commands.Internal.HelpWindowHelper"); + } +#endif helpSystem.OnProgress += new HelpSystem.HelpProgressHandler(HelpSystem_OnProgress); bool failed = false; @@ -559,6 +590,12 @@ private void WriteObjectsOrShowOnlineHelp(HelpInfo helpInfo, bool showFullHelp) throw PSTraceSource.NewInvalidOperationException(HelpErrors.NoURIFound); } } +#if !UNIX + else if (showFullHelp && ShowWindow) + { + graphicalHostReflectionWrapper.CallStaticMethod("ShowHelpWindow", helpInfo.FullHelp, this); + } +#endif else { // show inline help From 87c48e95722ce293be8d5101e3346f547ca6c5d3 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Fri, 25 Oct 2019 16:42:38 -0700 Subject: [PATCH 10/22] fix CodeFactor style issues --- .../HelpWindow/HelpParagraphBuilder.cs | 96 ++++++++++--------- .../HelpWindow/HelpViewModel.cs | 8 +- .../HelpWindow/HelpWindowSettings.Designer.cs | 2 +- .../ManagementList/Common/IsEqualConverter.cs | 6 +- .../Common/ListOrganizer.Generated.cs | 4 +- .../ManagementList/Common/ListOrganizer.cs | 4 +- .../Common/ListOrganizerItem.Generated.cs | 2 +- .../Common/ListOrganizerItem.cs | 4 +- .../ManagementList/Common/MessageTextBox.cs | 6 +- .../Common/StringFormatConverter.cs | 4 +- .../Common/TextBlockService.Generated.cs | 2 +- .../ManagementList/Common/WpfHelp.cs | 8 +- .../ResizerGripThicknessConverter.cs | 4 +- .../DefaultFilterRuleCustomizationFactory.cs | 24 ++--- .../FilterCore/FilterEvaluator.cs | 6 +- .../FilterCore/FilterExceptionEventArgs.cs | 2 +- .../FilterExpressionAndOperatorNode.cs | 2 +- .../FilterExpressionOperandNode.cs | 2 +- .../FilterExpressionOrOperatorNode.cs | 2 +- .../FilterRuleCustomizationFactory.cs | 2 +- .../FilterRules/ComparableValueFilterRule.cs | 2 +- .../FilterRules/FilterRuleExtensions.cs | 2 +- .../FilterRules/IsEmptyFilterRule.cs | 2 +- .../FilterRules/IsNotEmptyValidationRule.cs | 7 +- .../PropertyValueSelectorFilterRule.cs | 10 +- .../FilterCore/FilterRules/TextFilterRule.cs | 4 +- .../FilterCore/FilterUtilities.cs | 4 +- .../FilterCore/ItemsControlFilterEvaluator.cs | 4 +- .../FilterCore/ValidatingSelectorValue.cs | 2 +- .../FilterCore/ValidatingValue.cs | 8 +- .../FilterCore/ValidatingValueBase.cs | 14 +-- .../DataErrorInfoValidationResult.cs | 6 +- .../FilterProviders/FilterRulePanel.cs | 16 ++-- .../FilterRulePanelContentPresenter.cs | 2 +- .../FilterRulePanelController.cs | 4 +- .../FilterProviders/FilterRulePanelItem.cs | 6 +- .../FilterRuleTemplateSelector.cs | 4 +- .../FilterRuleToDisplayNameConverter.cs | 4 +- .../InputFieldBackgroundTextConverter.cs | 2 +- .../IsValidatingValueValidConverter.cs | 2 +- .../FilterProviders/SearchBox.Generated.cs | 2 +- .../FilterProviders/SearchBox.cs | 4 +- .../FilterProviders/SearchTextParser.cs | 8 +- ...tingSelectorValueToDisplayNameConverter.cs | 8 +- ...ingValueToGenericParameterTypeConverter.cs | 2 +- .../ManagementList/ColumnPicker.xaml.cs | 8 +- .../ManagementList/DefaultStringConverter.cs | 2 +- .../ManagementList/InnerListGridView.cs | 2 +- .../ManagementList/Innerlist.cs | 20 ++-- .../ManagementListStateDescriptor.cs | 24 ++--- .../ManagementListTitle.Generated.cs | 4 +- .../ManagementList/PropertyValueGetter.cs | 8 +- .../ViewGroupToStringConverter.cs | 6 +- .../ManagementList/managementlist.cs | 14 +-- .../ImageButtonToolTipConverter.cs | 4 +- .../Controls/ParameterSetControl.xaml.cs | 8 +- .../ViewModel/AllModulesViewModel.cs | 4 +- .../ShowCommand/ViewModel/CommandViewModel.cs | 14 +-- .../ShowCommand/ViewModel/ModuleViewModel.cs | 6 +- .../ViewModel/ParameterSetViewModel.cs | 2 +- .../ViewModel/ParameterViewModel.cs | 10 +- .../Windows/ShowAllModulesWindow.xaml.cs | 8 +- .../commandHelpers/HelpWindowHelper.cs | 2 +- .../commandHelpers/OutGridView.cs | 4 +- .../commandHelpers/ShowCommandHelper.cs | 35 +++---- src/ResGen/Program.cs | 7 +- .../help/HelpCommands.cs | 5 +- 67 files changed, 260 insertions(+), 256 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs index 788954f43ff..f0a23603147 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs @@ -23,7 +23,7 @@ internal class HelpParagraphBuilder : ParagraphBuilder /// /// new line separators /// - private static readonly string[] Separators = new [] { "\r\n", "\n" }; + private static readonly string[] Separators = new[] { "\r\n", "\n" }; /// /// Object with the cmdelt @@ -45,7 +45,12 @@ internal HelpParagraphBuilder(Paragraph paragraph, PSObject psObj) /// /// Enum for category of Help. /// - private enum HelpCategory { Default, DscResource, Class }; + private enum HelpCategory + { + Default, + DscResource, + Class + } /// /// Gets the string value of a property or null if it could not be retrieved @@ -73,22 +78,22 @@ internal void AddTextToParagraphBuilder() { this.ResetAllText(); - string strCategory = (HelpParagraphBuilder.GetProperty(this.psObj, "Category")).Value.ToString(); + string strCategory = HelpParagraphBuilder.GetProperty(this.psObj, "Category").Value.ToString(); HelpCategory category = HelpCategory.Default; - if (String.Compare(strCategory, "DscResource", StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(strCategory, "DscResource", StringComparison.OrdinalIgnoreCase) == 0) { category = HelpCategory.DscResource; } - else if (String.Compare(strCategory, "Class", StringComparison.OrdinalIgnoreCase) == 0) + else if (string.Compare(strCategory, "Class", StringComparison.OrdinalIgnoreCase) == 0) { category = HelpCategory.Class; } if (HelpParagraphBuilder.GetProperty(this.psObj, "Syntax") == null) { - if(category == HelpCategory.Default) + if (category == HelpCategory.Default) { // if there is no syntax, this is not the standard help // it might be an about page @@ -299,14 +304,13 @@ private static object[] GetPropertyObjectArray(PSObject obj, string propertyName if (innerObject is PSObject) { - return new [] { innerObject }; + return new[] { innerObject }; } object[] innerObjectArray = innerObject as object[]; return innerObjectArray; } - /// /// Adds a section that contains only a string /// @@ -365,7 +369,7 @@ private void AddSyntax(bool setting, string sectionTitle) continue; } - string commandStart = String.Format(CultureInfo.CurrentCulture, "{0} ", commandName); + string commandStart = string.Format(CultureInfo.CurrentCulture, "{0} ", commandName); this.AddText(HelpParagraphBuilder.AddIndent(commandStart), false); foreach (object parameterObj in parameterObjs) @@ -385,11 +389,11 @@ private void AddSyntax(bool setting, string sectionTitle) continue; } - string parameterType = parameterValue == null ? string.Empty : String.Format(CultureInfo.CurrentCulture, "<{0}>", parameterValue); + string parameterType = parameterValue == null ? string.Empty : string.Format(CultureInfo.CurrentCulture, "<{0}>", parameterValue); string parameterOptionalOpenBrace, parameterOptionalCloseBrace; - if (String.Equals(required, "true", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(required, "true", StringComparison.OrdinalIgnoreCase)) { parameterOptionalOpenBrace = string.Empty; parameterOptionalCloseBrace = string.Empty; @@ -402,7 +406,7 @@ private void AddSyntax(bool setting, string sectionTitle) string parameterNameOptionalOpenBrace, parameterNameOptionalCloseBrace; - if (String.Equals(position, "named", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(position, "named", StringComparison.OrdinalIgnoreCase)) { parameterNameOptionalOpenBrace = parameterNameOptionalCloseBrace = string.Empty; } @@ -412,7 +416,7 @@ private void AddSyntax(bool setting, string sectionTitle) parameterNameOptionalCloseBrace = "]"; } - string paramterPrefix = String.Format( + string paramterPrefix = string.Format( CultureInfo.CurrentCulture, "{0}{1}-", parameterOptionalOpenBrace, @@ -421,7 +425,7 @@ private void AddSyntax(bool setting, string sectionTitle) this.AddText(paramterPrefix, false); this.AddText(parameterName, true); - string paramterSuffix = String.Format( + string paramterSuffix = string.Format( CultureInfo.CurrentCulture, "{0} {1}{2} ", parameterNameOptionalCloseBrace, @@ -430,7 +434,7 @@ private void AddSyntax(bool setting, string sectionTitle) this.AddText(paramterSuffix, false); } - string commonParametersText = String.Format( + string commonParametersText = string.Format( CultureInfo.CurrentCulture, "[<{0}>]\r\n\r\n", HelpWindowResources.CommonParameters); @@ -522,7 +526,7 @@ private void AddExamples(bool setting, string sectionTitle) this.AddText("\r\n", false); } - string codeLine = String.Format( + string codeLine = string.Format( CultureInfo.CurrentCulture, "{0}{1}\r\n\r\n", introductionText, @@ -554,7 +558,7 @@ private void AddExamples(bool setting, string sectionTitle) private void AddMembers(bool setting, string sectionTitle) { - if(!setting || String.IsNullOrEmpty(sectionTitle)) + if(!setting || string.IsNullOrEmpty(sectionTitle)) { return; } @@ -590,7 +594,7 @@ private void AddMembers(bool setting, string sectionTitle) string type = GetPropertyString(member, "type"); string propertyType = null; - if (String.Compare("field", type, StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare("field", type, StringComparison.OrdinalIgnoreCase) == 0) { PSObject fieldData = HelpParagraphBuilder.GetPropertyObject(member, "fieldData") as PSObject; @@ -603,17 +607,17 @@ private void AddMembers(bool setting, string sectionTitle) description = GetPropertyString(propertyTypeObject, "description"); } - memberText = String.Format(CultureInfo.CurrentCulture, " [{0}] {1}\r\n", propertyType, name); + memberText = string.Format(CultureInfo.CurrentCulture, " [{0}] {1}\r\n", propertyType, name); } } - else if (String.Compare("method", type, StringComparison.OrdinalIgnoreCase) == 0) + else if (string.Compare("method", type, StringComparison.OrdinalIgnoreCase) == 0) { FormatMethodData(member, name, out memberText, out description); } - if (!String.IsNullOrEmpty(memberText)) + if (!string.IsNullOrEmpty(memberText)) { - this.AddText(HelpParagraphBuilder.AddIndent(""), false); + this.AddText(HelpParagraphBuilder.AddIndent(string.Empty), false); this.AddText(memberText, true); if (description != null) @@ -632,7 +636,7 @@ private static void FormatMethodData(PSObject member, string name, out string me memberText = null; description = null; - if (member == null || String.IsNullOrEmpty(name)) + if (member == null || string.IsNullOrEmpty(name)) { return; } @@ -640,7 +644,7 @@ private static void FormatMethodData(PSObject member, string name, out string me string returnType = null; StringBuilder parameterText = new StringBuilder(); - //Get method return type + // Get method return type PSObject returnTypeObject = HelpParagraphBuilder.GetPropertyObject(member, "returnValue") as PSObject; if (returnTypeObject != null) { @@ -651,7 +655,7 @@ private static void FormatMethodData(PSObject member, string name, out string me } } - //Get method description. + // Get method description. PSObject[] methodDescriptions = HelpParagraphBuilder.GetPropertyObject(member, "introduction") as PSObject[]; if (methodDescriptions != null) { @@ -659,15 +663,15 @@ private static void FormatMethodData(PSObject member, string name, out string me { description = GetPropertyString(methodDescription, "Text"); - //If we get an text we do not need to iterate more. - if (!String.IsNullOrEmpty(description)) + // If we get an text we do not need to iterate more. + if (!string.IsNullOrEmpty(description)) { break; } } } - //Get method parameters. + // Get method parameters. PSObject parametersObject = HelpParagraphBuilder.GetPropertyObject(member, "parameters") as PSObject; if (parametersObject != null) { @@ -686,26 +690,26 @@ private static void FormatMethodData(PSObject member, string name, out string me { parameterType = GetPropertyString(parameterTypeData, "name"); - //If there is no type for the paramter, we expect it is System.Object - if (String.IsNullOrEmpty(parameterType)) + // If there is no type for the paramter, we expect it is System.Object + if (string.IsNullOrEmpty(parameterType)) { parameterType = "object"; } } - string paramString = String.Format(CultureInfo.CurrentCulture, "[{0}] ${1},", parameterType, parameterName); + string paramString = string.Format(CultureInfo.CurrentCulture, "[{0}] ${1},", parameterType, parameterName); parameterText.Append(paramString); } - if (String.Compare(parameterText[parameterText.Length - 1].ToString(), ",", StringComparison.OrdinalIgnoreCase) == 0) + if (string.Compare(parameterText[parameterText.Length - 1].ToString(), ",", StringComparison.OrdinalIgnoreCase) == 0) { parameterText = parameterText.Remove(parameterText.Length - 1, 1); } } } - memberText = String.Format(CultureInfo.CurrentCulture, " [{0}] {1}({2})\r\n", returnType, name, parameterText); + memberText = string.Format(CultureInfo.CurrentCulture, " [{0}] {1}({2})\r\n", returnType, name, parameterText); } /// @@ -730,7 +734,7 @@ private void AddParameters(bool setting, string sectionTitle, string paramProper object[] parameterObjects = null; - //Root object for Class has members not parameters. + // Root object for Class has members not parameters. if (helpCategory != HelpCategory.Class) { parameterObjects = HelpParagraphBuilder.GetPropertyObjectArray(parameterRootObject, "parameter"); @@ -761,16 +765,14 @@ private void AddParameters(bool setting, string sectionTitle, string paramProper string defaultValue = GetPropertyString(parameter, "defaultValue"); string acceptWildcard = GetPropertyString(parameter, "globbing"); - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { continue; } - // This syntax string is not localized - if (helpCategory == HelpCategory.DscResource) { - this.AddText(HelpParagraphBuilder.AddIndent(""), false); + this.AddText(HelpParagraphBuilder.AddIndent(string.Empty), false); } else { @@ -778,7 +780,7 @@ private void AddParameters(bool setting, string sectionTitle, string paramProper } this.AddText(name, true); - string parameterText = String.Format( + string parameterText = string.Format( CultureInfo.CurrentCulture, " <{0}>\r\n", parameterValue); @@ -801,14 +803,14 @@ private void AddParameters(bool setting, string sectionTitle, string paramProper HelpWindowResources.ParameterAcceptWildcard); // justification of parameter values is not localized - string formatString = String.Format( + string formatString = string.Format( CultureInfo.CurrentCulture, "{{0,-{0}}}{{1}}", largestSize + 2); string tableLine; - tableLine = String.Format( + tableLine = string.Format( CultureInfo.CurrentCulture, formatString, HelpWindowResources.ParameterRequired, @@ -816,10 +818,10 @@ private void AddParameters(bool setting, string sectionTitle, string paramProper this.AddText(HelpParagraphBuilder.AddIndent(tableLine, 2), false); this.AddText("\r\n", false); - //these are not applicable for Dsc Resource help + // these are not applicable for Dsc Resource help if (helpCategory != HelpCategory.DscResource) { - tableLine = String.Format( + tableLine = string.Format( CultureInfo.CurrentCulture, formatString, HelpWindowResources.ParameterPosition, @@ -827,7 +829,7 @@ private void AddParameters(bool setting, string sectionTitle, string paramProper this.AddText(HelpParagraphBuilder.AddIndent(tableLine, 2), false); this.AddText("\r\n", false); - tableLine = String.Format( + tableLine = string.Format( CultureInfo.CurrentCulture, formatString, HelpWindowResources.ParameterDefaultValue, @@ -835,7 +837,7 @@ private void AddParameters(bool setting, string sectionTitle, string paramProper this.AddText(HelpParagraphBuilder.AddIndent(tableLine, 2), false); this.AddText("\r\n", false); - tableLine = String.Format( + tableLine = string.Format( CultureInfo.CurrentCulture, formatString, HelpWindowResources.ParameterPipelineInput, @@ -843,7 +845,7 @@ private void AddParameters(bool setting, string sectionTitle, string paramProper this.AddText(HelpParagraphBuilder.AddIndent(tableLine, 2), false); this.AddText("\r\n", false); - tableLine = String.Format( + tableLine = string.Format( CultureInfo.CurrentCulture, formatString, HelpWindowResources.ParameterAcceptWildcard, @@ -891,7 +893,7 @@ private void AddNavigationLink(bool setting, string sectionTitle) string text = GetPropertyString(linkObject, "linkText"); string uri = GetPropertyString(linkObject, "uri"); - string linkLine = String.IsNullOrEmpty(uri) ? text : String.Format( + string linkLine = string.IsNullOrEmpty(uri) ? text : string.Format( CultureInfo.CurrentCulture, HelpWindowResources.LinkTextFormat, text, diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs index 96b34812598..a5c83737de7 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs @@ -62,7 +62,7 @@ internal HelpViewModel(PSObject psObj, Paragraph documentParagraph) this.helpBuilder.BuildParagraph(); this.searcher = new ParagraphSearcher(); this.helpBuilder.PropertyChanged += new PropertyChangedEventHandler(this.HelpBuilder_PropertyChanged); - this.helpTitle = String.Format( + this.helpTitle = string.Format( CultureInfo.CurrentCulture, HelpWindowResources.HelpTitleFormat, HelpParagraphBuilder.GetPropertyString(psObj, "name")); @@ -112,7 +112,7 @@ public string ZoomLabel { get { - return String.Format(CultureInfo.CurrentCulture, HelpWindowResources.ZoomLabelTextFormat, this.zoom); + return string.Format(CultureInfo.CurrentCulture, HelpWindowResources.ZoomLabelTextFormat, this.zoom); } } @@ -242,7 +242,7 @@ private void SetMatchesLabel() { if (this.findText == null || this.findText.Trim().Length == 0) { - this.MatchesLabel = String.Empty; + this.MatchesLabel = string.Empty; } else { @@ -258,7 +258,7 @@ private void SetMatchesLabel() } else { - this.MatchesLabel = String.Format( + this.MatchesLabel = string.Format( CultureInfo.CurrentCulture, HelpWindowResources.SomeMatchesFormat, this.HelpBuilder.HighlightCount); diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindowSettings.Designer.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindowSettings.Designer.cs index 75260441491..865990c0086 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindowSettings.Designer.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindowSettings.Designer.cs @@ -11,7 +11,7 @@ // //------------------------------------------------------------------------------ -//namespace Microsoft.Management.UI.Internal { +// namespace Microsoft.Management.UI.Internal { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs index 5801220d912..cadfc8e357c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs @@ -44,12 +44,12 @@ public object Convert(object[] values, Type targetType, object parameter, System object item1 = values[0]; object item2 = values[1]; - if (null == item1) + if (item1 == null) { - return (null == item2); + return (item2 == null); } - if (null == item2) + if (item2 == null) { return false; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.Generated.cs index 14f11d91c2f..7dbebad8d2a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.Generated.cs @@ -343,7 +343,7 @@ protected virtual void OnItemsSourceChanged(PropertyChangedEventArgs /// Identifies the NoItemsText dependency property. /// - public static readonly DependencyProperty NoItemsTextProperty = DependencyProperty.Register( "NoItemsText", typeof(string), typeof(ListOrganizer), new PropertyMetadata( String.Empty, NoItemsTextProperty_PropertyChanged) ); + public static readonly DependencyProperty NoItemsTextProperty = DependencyProperty.Register( "NoItemsText", typeof(string), typeof(ListOrganizer), new PropertyMetadata( string.Empty, NoItemsTextProperty_PropertyChanged) ); /// /// Gets or sets a value that appears to inform the user that there are no items in the list. @@ -392,7 +392,7 @@ protected virtual void OnNoItemsTextChanged(PropertyChangedEventArgs e) /// /// Identifies the TextContentPropertyName dependency property. /// - public static readonly DependencyProperty TextContentPropertyNameProperty = DependencyProperty.Register( "TextContentPropertyName", typeof(string), typeof(ListOrganizer), new PropertyMetadata( String.Empty, TextContentPropertyNameProperty_PropertyChanged) ); + public static readonly DependencyProperty TextContentPropertyNameProperty = DependencyProperty.Register( "TextContentPropertyName", typeof(string), typeof(ListOrganizer), new PropertyMetadata( string.Empty, TextContentPropertyNameProperty_PropertyChanged) ); /// /// Gets or sets a value which dictates what binding is used to provide content for the items in the list. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.cs index 42339e18513..624d4d6ec5a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.cs @@ -42,7 +42,7 @@ protected override void OnKeyDown(KeyEventArgs e) partial void OnSelectItemExecutedImplementation(ExecutedRoutedEventArgs e) { - if (null == e.Parameter) + if (e.Parameter == null) { throw new ArgumentException("e.Parameter is null", "e"); } @@ -53,7 +53,7 @@ partial void OnSelectItemExecutedImplementation(ExecutedRoutedEventArgs e) partial void OnDeleteItemExecutedImplementation(ExecutedRoutedEventArgs e) { - if (null == e.Parameter) + if (e.Parameter == null) { throw new ArgumentException("e.Parameter is null", "e"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.Generated.cs index fd261b3de74..098bf384b83 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.Generated.cs @@ -55,7 +55,7 @@ partial class ListOrganizerItem /// /// Identifies the TextContentPropertyName dependency property. /// - public static readonly DependencyProperty TextContentPropertyNameProperty = DependencyProperty.Register( "TextContentPropertyName", typeof(string), typeof(ListOrganizerItem), new PropertyMetadata( String.Empty, TextContentPropertyNameProperty_PropertyChanged) ); + public static readonly DependencyProperty TextContentPropertyNameProperty = DependencyProperty.Register( "TextContentPropertyName", typeof(string), typeof(ListOrganizerItem), new PropertyMetadata( string.Empty, TextContentPropertyNameProperty_PropertyChanged) ); /// /// Gets or sets a value which dictates what binding is used to provide content for the items in the list. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs index 3141731ff93..8a80a338451 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs @@ -156,7 +156,7 @@ private void ChangeFromEditToDisplayMode() // on the rename button causes the the edit box to change and // then have re-toggle. DependencyObject d = Mouse.DirectlyOver as DependencyObject; - if (null == d || !(this.renameButton.IsAncestorOf(d) && Mouse.LeftButton == MouseButtonState.Pressed)) + if (d ==null || !(this.renameButton.IsAncestorOf(d) && Mouse.LeftButton == MouseButtonState.Pressed)) { this.renameButton.IsChecked = false; } @@ -194,7 +194,7 @@ private void UpdateTextContentBindings() return; } - if (!String.IsNullOrEmpty(this.TextContentPropertyName)) + if (!string.IsNullOrEmpty(this.TextContentPropertyName)) { Binding b = new Binding(this.TextContentPropertyName); b.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs index ac18eef69d9..46a4c4e5f24 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs @@ -21,7 +21,7 @@ static partial void StaticConstructorImplementation() TextProperty.OverrideMetadata( typeof(MessageTextBox), new FrameworkPropertyMetadata( - String.Empty, + string.Empty, null, new CoerceValueCallback(OnTextBoxTextCoerce))); } @@ -30,11 +30,11 @@ static partial void StaticConstructorImplementation() private void UpdateIsBackgroundTextShown(string text) { - if (String.IsNullOrEmpty(text) == false && this.IsBackgroundTextShown) + if (string.IsNullOrEmpty(text) == false && this.IsBackgroundTextShown) { this.IsBackgroundTextShown = false; } - else if (String.IsNullOrEmpty(text) && this.IsBackgroundTextShown == false) + else if (string.IsNullOrEmpty(text) && this.IsBackgroundTextShown == false) { this.IsBackgroundTextShown = true; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/StringFormatConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/StringFormatConverter.cs index 2893aa3d825..40469afb962 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/StringFormatConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/StringFormatConverter.cs @@ -30,12 +30,12 @@ public object Convert(object value, Type targetType, Object parameter, CultureIn string str = (string)value; string formatString = (string)parameter; - if (String.IsNullOrEmpty(str)) + if (string.IsNullOrEmpty(str)) { return null; } - return String.Format(culture, formatString, str); + return string.Format(culture, formatString, str); } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.Generated.cs index 1e97eb729b4..5a7523cf04e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.Generated.cs @@ -136,7 +136,7 @@ static private void IsTextTrimmedMonitoringEnabledProperty_PropertyChanged(Depen /// /// Identifies the UntrimmedText dependency property. /// - public static readonly DependencyProperty UntrimmedTextProperty = DependencyProperty.RegisterAttached( "UntrimmedText", typeof(string), typeof(TextBlockService), new PropertyMetadata( String.Empty, UntrimmedTextProperty_PropertyChanged) ); + public static readonly DependencyProperty UntrimmedTextProperty = DependencyProperty.RegisterAttached( "UntrimmedText", typeof(string), typeof(TextBlockService), new PropertyMetadata( string.Empty, UntrimmedTextProperty_PropertyChanged) ); /// /// Gets the untrimmed text. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs index dd95223415a..4ff710825b1 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs @@ -271,7 +271,7 @@ public static void AddChild(FrameworkElement parent, FrameworkElement element) /// Returns an object of type T if found, otherwise null. public static T GetVisualChild(DependencyObject obj) where T : DependencyObject { - if (null == obj) + if (obj == null) { return null; } @@ -443,7 +443,7 @@ public static T GetOptionalTemplateChild(Control templateParent, string child throw new ArgumentNullException("templateParent"); } - if (String.IsNullOrEmpty(childName)) + if (string.IsNullOrEmpty(childName)) { throw new ArgumentNullException("childName"); } @@ -485,7 +485,7 @@ public static T GetTemplateChild(Control templateParent, string childName) wh /// The name of the expected template part. private static void HandleWrongTemplatePartType(string name) { - throw new ApplicationException(String.Format( + throw new ApplicationException(string.Format( CultureInfo.CurrentCulture, "A template part with the name of '{0}' is not of type {1}.", name, @@ -499,7 +499,7 @@ private static void HandleWrongTemplatePartType(string name) /// The name of the expected template part. public static void HandleMissingTemplatePart(string name) { - throw new ApplicationException(String.Format( + throw new ApplicationException(string.Format( CultureInfo.CurrentCulture, "A template part with the name of '{0}' and type of {1} was not found.", name, diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs index d66a958ac0b..5939c963a7b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs @@ -43,8 +43,8 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur throw new ArgumentNullException("values"); } - if (Object.ReferenceEquals(values[0], DependencyProperty.UnsetValue) || - Object.ReferenceEquals(values[1], DependencyProperty.UnsetValue)) + if (object.ReferenceEquals(values[0], DependencyProperty.UnsetValue) || + object.ReferenceEquals(values[1], DependencyProperty.UnsetValue)) { return DependencyProperty.UnsetValue; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs index cd140ee433c..72de06fd05c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs @@ -35,7 +35,7 @@ public override IPropertyValueGetter PropertyValueGetter } set { - if (null == value) + if (value == null) { throw new ArgumentNullException("value"); } @@ -105,12 +105,12 @@ public override ICollection CreateDefaultFilterRulesForPropertyValue /// public override void TransferValues(FilterRule oldRule, FilterRule newRule) { - if (null == oldRule) + if (oldRule == null) { throw new ArgumentNullException("oldRule"); } - if (null == newRule) + if (newRule == null) { throw new ArgumentNullException("newRule"); } @@ -129,7 +129,7 @@ public override void TransferValues(FilterRule oldRule, FilterRule newRule) /// public override void ClearValues(FilterRule rule) { - if (null == rule) + if (rule == null) { throw new ArgumentNullException("rule"); } @@ -162,7 +162,7 @@ public override void ClearValues(FilterRule rule) /// public override string GetErrorMessageForInvalidValue(string value, Type typeToParseTo) { - if (null == typeToParseTo) + if (typeToParseTo == null) { throw new ArgumentNullException("typeToParseTo"); } @@ -181,15 +181,15 @@ public override string GetErrorMessageForInvalidValue(string value, Type typeToP if (isNumericType) { - return String.Format(CultureInfo.CurrentCulture, UICultureResources.ErrorMessageForUnparsableNumericType); + return string.Format(CultureInfo.CurrentCulture, UICultureResources.ErrorMessageForUnparsableNumericType); } if (typeToParseTo == typeof(DateTime)) { - return String.Format(CultureInfo.CurrentCulture, UICultureResources.ErrorMessageForUnparsableDateTimeType, CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern); + return string.Format(CultureInfo.CurrentCulture, UICultureResources.ErrorMessageForUnparsableDateTimeType, CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern); } - return String.Format(CultureInfo.CurrentCulture, UICultureResources.ErrorTextBoxTypeConversionErrorText, typeToParseTo.Name); + return string.Format(CultureInfo.CurrentCulture, UICultureResources.ErrorTextBoxTypeConversionErrorText, typeToParseTo.Name); } #region Private Methods @@ -219,10 +219,10 @@ private bool TryGetGenericParameterForComparableValueFilterRule(FilterRule rule, private object GetValueFromValidatingValue(FilterRule rule, string propertyName) { - Debug.Assert(null != rule && !String.IsNullOrEmpty(propertyName)); + Debug.Assert(rule != null && !string.IsNullOrEmpty(propertyName)); // NOTE: This isn't needed but OACR is complaining - if (null == rule) + if (rule == null) { throw new ArgumentNullException("rule"); } @@ -238,10 +238,10 @@ private object GetValueFromValidatingValue(FilterRule rule, string propertyName) private void SetValueOnValidatingValue(FilterRule rule, string propertyName, object value) { - Debug.Assert(null != rule && !String.IsNullOrEmpty(propertyName)); + Debug.Assert(rule != null && !string.IsNullOrEmpty(propertyName)); // NOTE: This isn't needed but OACR is complaining - if (null == rule) + if (rule == null) { throw new ArgumentNullException("rule"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs index 87e036c0752..e10f8f8ddd7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs @@ -143,7 +143,7 @@ public FilterExpressionNode FilterExpression /// public void AddFilterExpressionProvider(IFilterExpressionProvider provider) { - if (null == provider) + if (provider == null) { throw new ArgumentNullException("provider"); } @@ -160,7 +160,7 @@ public void AddFilterExpressionProvider(IFilterExpressionProvider provider) /// public void RemoveFilterExpressionProvider(IFilterExpressionProvider provider) { - if (null == provider) + if (provider == null) { throw new ArgumentNullException("provider"); } @@ -179,7 +179,7 @@ public void RemoveFilterExpressionProvider(IFilterExpressionProvider provider) /// protected void NotifyPropertyChanged(string propertyName) { - Debug.Assert(!String.IsNullOrEmpty(propertyName)); + Debug.Assert(!string.IsNullOrEmpty(propertyName)); PropertyChangedEventHandler eh = this.PropertyChanged; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExceptionEventArgs.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExceptionEventArgs.cs index 303ffc4bc34..50d33f6a964 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExceptionEventArgs.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExceptionEventArgs.cs @@ -32,7 +32,7 @@ public Exception Exception /// public FilterExceptionEventArgs(Exception exception) { - if (null == exception) + if (exception == null) { throw new ArgumentNullException("exception"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs index 19b7335d1f4..cd9101ba366 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs @@ -52,7 +52,7 @@ public FilterExpressionAndOperatorNode() /// public FilterExpressionAndOperatorNode(IEnumerable children) { - if (null == children) + if (children == null) { throw new ArgumentNullException("children"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs index 9531a62561c..b939e5aa089 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs @@ -38,7 +38,7 @@ public FilterRule Rule /// public FilterExpressionOperandNode(FilterRule rule) { - if (null == rule) + if (rule == null) { throw new ArgumentNullException("rule"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs index 9717fc78720..23e6125b7f7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs @@ -52,7 +52,7 @@ public FilterExpressionOrOperatorNode() /// public FilterExpressionOrOperatorNode(IEnumerable children) { - if (null == children) + if (children == null) { throw new ArgumentNullException("children"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs index f85e4289afb..fb744576459 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs @@ -32,7 +32,7 @@ public static FilterRuleCustomizationFactory FactoryInstance set { - if (null == value) + if (value == null) { throw new ArgumentNullException("value"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs index 11c17cda9b2..e6d6171148f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs @@ -43,7 +43,7 @@ protected bool DefaultNullValueEvaluation /// public override bool Evaluate(object item) { - if (null == item) + if (item == null) { return this.DefaultNullValueEvaluation; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs index 0a84bd17fd1..794f9e4ec9b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs @@ -27,7 +27,7 @@ public static class FilterRuleExtensions /// public static FilterRule DeepCopy(this FilterRule rule) { - if (null == rule) + if (rule == null) { throw new ArgumentNullException("rule"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs index 8e4bb3b512f..6d4e9b5f956 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs @@ -31,7 +31,7 @@ public IsEmptyFilterRule() /// public override bool Evaluate(object item) { - if (null == item) + if (item == null) { return true; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs index f5185bd9fac..dbf3a16d70b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs @@ -14,7 +14,7 @@ public class IsNotEmptyValidationRule : DataErrorInfoValidationRule { #region Properties - private static readonly DataErrorInfoValidationResult EmptyValueResult = new DataErrorInfoValidationResult(false, null, String.Empty); + private static readonly DataErrorInfoValidationResult EmptyValueResult = new DataErrorInfoValidationResult(false, null, string.Empty); #endregion Properties @@ -34,7 +34,7 @@ public class IsNotEmptyValidationRule : DataErrorInfoValidationRule /// public override DataErrorInfoValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { - if (null == value) + if (value == null) { return EmptyValueResult; } @@ -53,10 +53,9 @@ public override DataErrorInfoValidationResult Validate(object value, System.Glob #endregion Public Methods - //private internal static bool IsStringNotEmpty(string value) { - return !(String.IsNullOrEmpty(value) || 0 == value.Trim().Length); + return !(string.IsNullOrEmpty(value) || 0 == value.Trim().Length); } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs index 571253216db..d852382f7ae 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs @@ -66,17 +66,17 @@ public PropertyValueSelectorFilterRule(string propertyName, string propertyDispl /// public PropertyValueSelectorFilterRule(string propertyName, string propertyDisplayName, IEnumerable rules) { - if (String.IsNullOrEmpty(propertyName)) + if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentNullException("propertyName"); } - if (String.IsNullOrEmpty(propertyDisplayName)) + if (string.IsNullOrEmpty(propertyDisplayName)) { throw new ArgumentNullException("propertyDisplayName"); } - if (null == rules) + if (rules == null) { throw new ArgumentNullException("rules"); } @@ -86,7 +86,7 @@ public PropertyValueSelectorFilterRule(string propertyName, string propertyDispl foreach (FilterRule rule in rules) { - if (null == rule) + if (rule == null) { throw new ArgumentException("A value within rules is null", "rules"); } @@ -117,7 +117,7 @@ public override bool Evaluate(object item) return false; } - if (null == item) + if (item == null) { return false; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs index f28714e9a86..7f1339b354e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs @@ -83,7 +83,7 @@ protected internal string GetParsedValue(out bool evaluateAsExactMatch) // If it's an exact-match value, remove quotes and use the exact-match pattern \\ if (evaluateAsExactMatch) { - parsedValue = parsedValue.Replace("\"", String.Empty); + parsedValue = parsedValue.Replace("\"", string.Empty); } return parsedValue; @@ -122,7 +122,7 @@ protected internal string GetRegexPattern(string pattern, string exactMatchPatte value = Regex.Escape(value); // Format the pattern using the specified data \\ - return String.Format(CultureInfo.InvariantCulture, pattern, value); + return string.Format(CultureInfo.InvariantCulture, pattern, value); } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterUtilities.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterUtilities.cs index 81f0292b08b..362b67ec145 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterUtilities.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterUtilities.cs @@ -15,13 +15,13 @@ internal static bool TryCastItem(object item, out T castItem) { castItem = default(T); - bool isItemUncastable = null == item && typeof(T).IsValueType; + bool isItemUncastable = item == null && typeof(T).IsValueType; if (isItemUncastable) { return false; } - bool shouldCastToString = null != item && typeof(string) == typeof(T); + bool shouldCastToString = item != null && typeof(string) == typeof(T); if (shouldCastToString) { // NOTE: string => T doesn't compile. We confuse the type system diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs index 2d87cf2d629..24e62eb9c95 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs @@ -65,7 +65,7 @@ private FilterExpressionNode CachedFilterExpression /// public override void StartFilter() { - if (null == this.FilterTarget) + if (this.FilterTarget == null) { throw new InvalidOperationException("FilterTarget is null."); } @@ -89,7 +89,7 @@ public override void StartFilter() /// public override void StopFilter() { - if (null == this.FilterTarget) + if (this.FilterTarget == null) { throw new InvalidOperationException("FilterTarget is null."); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs index 2c81801ed14..bd3dfc2fde8 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs @@ -186,7 +186,7 @@ protected override DataErrorInfoValidationResult Validate(string columnName) { if (!columnName.Equals(SelectedIndexPropertyName, StringComparison.CurrentCulture)) { - throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "{0} is not a valid column name.", columnName), "columnName"); + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "{0} is not a valid column name.", columnName), "columnName"); } if (!this.IsIndexWithinBounds(this.SelectedIndex)) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs index acd534ecb59..b9ff40eadc5 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs @@ -126,7 +126,7 @@ protected override DataErrorInfoValidationResult Validate(string columnName) if (this.IsValueEmpty()) { - return new DataErrorInfoValidationResult(false, null, String.Empty); + return new DataErrorInfoValidationResult(false, null, string.Empty); } T castValue; @@ -147,14 +147,14 @@ protected override DataErrorInfoValidationResult Validate(string columnName) private bool IsValueEmpty() { - if (null == this.Value) + if (this.Value == null) { return true; } string stringValue = this.Value.ToString(); - if (String.IsNullOrEmpty(stringValue)) + if (string.IsNullOrEmpty(stringValue)) { return true; } @@ -166,7 +166,7 @@ private bool TryGetCastValue(object rawValue, out T castValue) { castValue = default(T); - if (null == rawValue) + if (rawValue == null) { throw new ArgumentNullException("rawValue"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs index c20f02849a2..fa687903902 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs @@ -82,7 +82,7 @@ public string this[string columnName] { get { - if (String.IsNullOrEmpty(columnName)) + if (string.IsNullOrEmpty(columnName)) { throw new ArgumentNullException("columnName"); } @@ -104,7 +104,7 @@ public string Error get { DataErrorInfoValidationResult result = this.GetValidationResult(); - return (!result.IsValid) ? result.ErrorMessage : String.Empty; + return (!result.IsValid) ? result.ErrorMessage : string.Empty; } } @@ -140,7 +140,7 @@ public string Error /// The validation rule to add. public void AddValidationRule(DataErrorInfoValidationRule rule) { - if (null == rule) + if (rule == null) { throw new ArgumentNullException("rule"); } @@ -161,7 +161,7 @@ public void AddValidationRule(DataErrorInfoValidationRule rule) /// The rule to remove. public void RemoveValidationRule(DataErrorInfoValidationRule rule) { - if (null == rule) + if (rule == null) { throw new ArgumentNullException("rule"); } @@ -222,9 +222,9 @@ internal DataErrorInfoValidationResult EvaluateValidationRules(object value, Sys foreach (DataErrorInfoValidationRule rule in this.ValidationRules) { DataErrorInfoValidationResult result = rule.Validate(value, cultureInfo); - if (null == result) + if (result == null) { - throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, "DataErrorInfoValidationResult not returned by ValidationRule: {0}", rule.ToString())); + throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "DataErrorInfoValidationResult not returned by ValidationRule: {0}", rule.ToString())); } if (!result.IsValid) @@ -279,7 +279,7 @@ protected void NotifyPropertyChanged(string propertyName) private DataErrorInfoValidationResult GetValidationResult() { - if (null == this.cachedValidationResult) + if (this.cachedValidationResult == null) { this.UpdateValidationResult(); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs index 1f5dc43a2b3..125496933fe 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs @@ -33,7 +33,7 @@ public string ErrorMessage get; private set; } - private static readonly DataErrorInfoValidationResult valid = new DataErrorInfoValidationResult(true, null, String.Empty); + private static readonly DataErrorInfoValidationResult valid = new DataErrorInfoValidationResult(true, null, string.Empty); /// /// Geta an instance of DataErrorInfoValidationResult that corresponds @@ -69,8 +69,8 @@ public string ErrorMessage public DataErrorInfoValidationResult(bool isValid, object errorContent, string errorMessage) : base(isValid, errorContent) { - this.IsUserVisible = !String.IsNullOrEmpty(errorMessage); - this.ErrorMessage = errorMessage ?? String.Empty; + this.IsUserVisible = !string.IsNullOrEmpty(errorMessage); + this.ErrorMessage = errorMessage ?? string.Empty; } #endregion Ctor diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs index c7285c872a4..68e6197b045 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs @@ -154,12 +154,12 @@ public FilterRulePanel() /// public void AddFilterRulePanelItemContentTemplate(Type type, DataTemplate dataTemplate) { - if (null == type) + if (type == null) { throw new ArgumentNullException("type"); } - if (null == dataTemplate) + if (dataTemplate == null) { throw new ArgumentNullException("dataTemplate"); } @@ -176,7 +176,7 @@ public void AddFilterRulePanelItemContentTemplate(Type type, DataTemplate dataTe /// public void RemoveFilterRulePanelItemContentTemplate(Type type) { - if (null == type) + if (type == null) { throw new ArgumentNullException("type"); } @@ -237,7 +237,7 @@ partial void OnAddRulesExecutedImplementation(ExecutedRoutedEventArgs e) { Debug.Assert(null != e); - if (null == e.Parameter) + if (e.Parameter == null) { throw new ArgumentException("e.Parameter is null.", "e"); } @@ -248,7 +248,7 @@ partial void OnAddRulesExecutedImplementation(ExecutedRoutedEventArgs e) foreach (object item in selectedItems) { FilterRulePanelItem newItem = item as FilterRulePanelItem; - if (null == newItem) + if (newItem == null) { throw new ArgumentException( "e.Parameter contains a value which is not a valid FilterRulePanelItem object.", @@ -272,13 +272,13 @@ partial void OnRemoveRuleExecutedImplementation(ExecutedRoutedEventArgs e) { Debug.Assert(null != e); - if (null == e.Parameter) + if (e.Parameter == null) { throw new ArgumentException("e.Parameter is null.", "e"); } FilterRulePanelItem item = e.Parameter as FilterRulePanelItem; - if (null == item) + if (item == null) { throw new ArgumentException("e.Parameter is not a valid FilterRulePanelItem object.", "e"); } @@ -349,7 +349,7 @@ private void InitializeTemplatesForInputTypes() private void AddFilterRulePanelItemContentTemplate(Type type, string resourceName) { Debug.Assert(null != type); - Debug.Assert(!String.IsNullOrEmpty(resourceName)); + Debug.Assert(!string.IsNullOrEmpty(resourceName)); var templateInfo = new ComponentResourceKey(typeof(FilterRulePanel), resourceName); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs index 0479518eca7..235a3cf5262 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs @@ -42,7 +42,7 @@ public IValueConverter ContentConverter /// protected override DataTemplate ChooseTemplate() { - if (null == this.ContentTemplateSelector || null == this.ContentConverter) + if (this.ContentTemplateSelector == null || this.ContentConverter == null) { return base.ChooseTemplate(); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs index 006efd8049c..317e9abd3fa 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs @@ -88,7 +88,7 @@ public FilterRulePanelController() /// public void AddFilterRulePanelItem(FilterRulePanelItem item) { - if (null == item) + if (item == null) { throw new ArgumentNullException("item"); } @@ -116,7 +116,7 @@ private void Rule_EvaluationResultInvalidated(object sender, EventArgs e) /// public void RemoveFilterRulePanelItem(FilterRulePanelItem item) { - if (null == item) + if (item == null) { throw new ArgumentNullException("item"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs index 1e4a029e531..206e288a847 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs @@ -79,12 +79,12 @@ protected internal set /// public FilterRulePanelItem(FilterRule rule, string groupId) { - if (null == rule) + if (rule == null) { throw new ArgumentNullException("rule"); } - if (String.IsNullOrEmpty(groupId)) + if (string.IsNullOrEmpty(groupId)) { throw new ArgumentNullException("groupId"); } @@ -105,7 +105,7 @@ public FilterRulePanelItem(FilterRule rule, string groupId) /// protected void NotifyPropertyChanged(string propertyName) { - Debug.Assert(!String.IsNullOrEmpty(propertyName)); + Debug.Assert(!string.IsNullOrEmpty(propertyName)); PropertyChangedEventHandler eh = this.PropertyChanged; if (null != eh) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs index 67628f5a7f9..1e8e52e416a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs @@ -40,13 +40,13 @@ public IDictionary TemplateDictionary /// public override DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container) { - if (null == item) + if (item == null) { return base.SelectTemplate(item, container); } Type type = item as Type; - if (null == type) + if (type == null) { type = item.GetType(); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs index fb901fddc2d..470e2656e34 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs @@ -35,14 +35,14 @@ public class FilterRuleToDisplayNameConverter : IValueConverter /// public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - if (null == value) + if (value == null) { return DependencyProperty.UnsetValue; } FilterRule rule = value as FilterRule; - if (null == rule) + if (rule == null) { throw new ArgumentException("value of type FilterRule expected.", "value"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs index edfacfa1c85..c96584fe455 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs @@ -40,7 +40,7 @@ public class InputFieldBackgroundTextConverter : IValueConverter /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (null == value) + if (value == null) { throw new ArgumentNullException("value"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs index cc55f3072e9..f51e3cc3d5d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs @@ -36,7 +36,7 @@ public class IsValidatingValueValidConverter : IValueConverter public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { string error = (string)value; - return String.IsNullOrEmpty(error); + return string.IsNullOrEmpty(error); } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.Generated.cs index bd03d9bb128..9d2144fc766 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.Generated.cs @@ -115,7 +115,7 @@ protected virtual void OnBackgroundTextChanged(PropertyChangedEventArgs /// /// Identifies the Text dependency property. /// - public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof(string), typeof(SearchBox), new PropertyMetadata( String.Empty, TextProperty_PropertyChanged) ); + public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof(string), typeof(SearchBox), new PropertyMetadata( string.Empty, TextProperty_PropertyChanged) ); /// /// Gets or sets the text contents of the search box. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs index 20e49dfde4a..862129e6b58 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs @@ -46,7 +46,7 @@ public bool HasFilterExpression { get { - return (false == String.IsNullOrEmpty(this.Text)); + return (false == string.IsNullOrEmpty(this.Text)); } } @@ -106,7 +106,7 @@ partial void OnClearTextCanExecuteImplementation(CanExecuteRoutedEventArgs e) partial void OnClearTextExecutedImplementation(ExecutedRoutedEventArgs e) { - this.Text = String.Empty; + this.Text = string.Empty; } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParser.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParser.cs index aae85b1aba9..53bdb8070f0 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParser.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParser.cs @@ -80,7 +80,7 @@ public void ClearSearchableRules() /// A read-only collection of results. public virtual ReadOnlyCollection Parse(string text) { - if (String.IsNullOrEmpty(text)) + if (string.IsNullOrEmpty(text)) { return new ReadOnlyCollection(new List(0)); } @@ -124,9 +124,9 @@ protected virtual string GetPattern() patterns.Add(rule.Pattern); } - patterns.Add(String.Format(CultureInfo.InvariantCulture, "(?<{0}>){1}", FullTextRuleGroupName, ValuePattern)); + patterns.Add(string.Format(CultureInfo.InvariantCulture, "(?<{0}>){1}", FullTextRuleGroupName, ValuePattern)); - return String.Join("|", patterns.ToArray()); + return string.Join("|", patterns.ToArray()); } /// @@ -211,7 +211,7 @@ public SearchableRule(string uniqueId, SelectorFilterRule selectorFilterRule, Te this.UniqueId = uniqueId; this.selectorFilterRule = selectorFilterRule; this.childRule = childRule; - this.Pattern = String.Format(CultureInfo.InvariantCulture, "(?<{0}>){1}\\s*:\\s*{2}", uniqueId, Regex.Escape(selectorFilterRule.DisplayName), SearchTextParser.ValuePattern); + this.Pattern = string.Format(CultureInfo.InvariantCulture, "(?<{0}>){1}\\s*:\\s*{2}", uniqueId, Regex.Escape(selectorFilterRule.DisplayName), SearchTextParser.ValuePattern); } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs index e99ac89519a..19a968380e1 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs @@ -38,12 +38,12 @@ public class ValidatingSelectorValueToDisplayNameConverter : IMultiValueConverte /// public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - if (null == values) + if (values == null) { throw new ArgumentNullException("values"); } - if (2 != values.Length) + if (values.Length != 2) { throw new ArgumentException("Two values expected", "values"); } @@ -52,12 +52,12 @@ public object Convert(object[] values, Type targetType, object parameter, System object input = values[0]; IValueConverter converter = values[1] as IValueConverter; - if (null == converter) + if (converter == null) { throw new ArgumentException("Second value should be a IValueConverter", "values"); } - if (typeof(string) != targetType) + if (targetType != typeof(string)) { throw new ArgumentException("targetType should be of type string", "targetType"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs index 690c2cdbb4f..de5bbf2931c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs @@ -45,7 +45,7 @@ public static ValidatingValueToGenericParameterTypeConverter Instance /// public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - if (null == value) + if (value == null) { return typeof(string); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs index f805362402f..6acf2b6c95c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs @@ -59,12 +59,12 @@ internal ColumnPicker( ICollection availableColumns) : this() { - if (null == columns) + if (columns == null) { throw new ArgumentNullException("columns"); } - if (null == availableColumns) + if (availableColumns == null) { throw new ArgumentNullException("availableColumns"); } @@ -332,7 +332,7 @@ private void NotSelectedList_MouseDoubleClick(object sender, System.Windows.Inpu } // Ignore double-clicks on the listbox whitespace - if (null == this.PART_NotSelectedList.ContainerFromElement((DependencyObject)e.OriginalSource)) + if (this.PART_NotSelectedList.ContainerFromElement((DependencyObject)e.OriginalSource) == null) { return; } @@ -359,7 +359,7 @@ private void SelectedList_MouseDoubleClick(object sender, System.Windows.Input.M } // Ignore double-clicks on the listbox whitespace - if (null == this.PART_SelectedList.ContainerFromElement((DependencyObject)e.OriginalSource)) + if (this.PART_SelectedList.ContainerFromElement((DependencyObject)e.OriginalSource) == null) { return; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs index a574e82cb22..3a4d2dc965d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs @@ -69,7 +69,7 @@ public object Convert(object[] values, Type targetType, object parameter, System } string val = values[0] as string; - if (!String.IsNullOrEmpty(val)) + if (!string.IsNullOrEmpty(val)) { return val; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs index 3040e7c78ac..805b16d2968 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs @@ -199,7 +199,7 @@ private void Columns_CollectionChanged(object sender, NotifyCollectionChangedEve if (!this.canChangeColumns) { throw new NotSupportedException( - String.Format( + string.Format( CultureInfo.InvariantCulture, InvariantResources.CannotModified, InvariantResources.Columns, diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs index bdb80622358..c48a3e21e72 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs @@ -226,7 +226,7 @@ private void UpdatePrimarySortColumn() { foreach (InnerListColumn column in this.InnerGrid.AvailableColumns) { - bool isPrimarySortColumn = Object.ReferenceEquals(this.sortedColumn, column); + bool isPrimarySortColumn = object.ReferenceEquals(this.sortedColumn, column); InnerList.SetIsPrimarySortColumn(column, isPrimarySortColumn); InnerList.SetIsPrimarySortColumn((GridViewColumnHeader)column.Header, isPrimarySortColumn); @@ -259,7 +259,7 @@ private List GetDescriptionsForSorting() /// public void ClearSort() { - if (null == this.CollectionView) + if (this.CollectionView == null) { return; } @@ -295,11 +295,11 @@ protected override void OnItemsSourceChanged(System.Collections.IEnumerable oldV { base.OnItemsSourceChanged(oldValue, newValue); - this.itemsSourceIsEmpty = (null != this.ItemsSource && false == this.ItemsSource.GetEnumerator().MoveNext()); + this.itemsSourceIsEmpty = null != this.ItemsSource && this.ItemsSource.GetEnumerator().MoveNext() == false; // A view can be created if there is data to auto-generate columns, or columns are added programatically \\ bool canCreateView = (null != this.ItemsSource) && - (false == this.itemsSourceIsEmpty || false == this.AutoGenerateColumns); + (this.itemsSourceIsEmpty == false || this.AutoGenerateColumns == false); if (canCreateView) { @@ -362,7 +362,7 @@ protected override void OnKeyDown(KeyEventArgs e) // If pressing Left or Right on a column header, move the focus \\ GridViewColumnHeader header = e.OriginalSource as GridViewColumnHeader; - if (null != header) + if (header != null) { header.MoveFocus(new TraversalRequest(KeyboardHelp.GetNavigationDirection(this, e.Key))); e.Handled = true; @@ -386,7 +386,7 @@ private static void InnerList_OnViewChanged(DependencyObject obj, DependencyProp InnerListGridView innerGrid = e.NewValue as InnerListGridView; if (newGrid != null && innerGrid == null) { - throw new NotSupportedException(String.Format( + throw new NotSupportedException(string.Format( CultureInfo.InvariantCulture, InvariantResources.ViewSetWithType, typeof(GridView).Name, @@ -403,7 +403,7 @@ private static void InnerList_OnViewChanged(DependencyObject obj, DependencyProp private static NotSupportedException GetItemsException() { return new NotSupportedException( - String.Format( + string.Format( CultureInfo.InvariantCulture, InvariantResources.NotSupportAddingToItems, typeof(InnerList).Name, @@ -483,7 +483,7 @@ private void UpdateView(IEnumerable value) this.View = this.innerGrid; this.SetColumnHeaderActions(); - if (null != sortedColumn && this.Columns.Contains(sortedColumn)) + if (sortedColumn != null && this.Columns.Contains(sortedColumn)) { this.ApplySort(sortedColumn, false); } @@ -597,7 +597,7 @@ private string GetClipboardTextLineForSelectedItem(object value) object propertyValue; if (!FilterRuleCustomizationFactory.FactoryInstance.PropertyValueGetter.TryGetPropertyValue(column.DataDescription.PropertyName, value, out propertyValue)) { - propertyValue = String.Empty; + propertyValue = string.Empty; } entryText.AppendFormat(CultureInfo.CurrentCulture, "{0}\t", propertyValue); @@ -608,7 +608,7 @@ private string GetClipboardTextLineForSelectedItem(object value) private void SetClipboardWithSelectedItemsText(string text) { - if (String.IsNullOrEmpty(text)) + if (string.IsNullOrEmpty(text)) { return; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs index dcb310bfdfa..8c21dc586f5 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs @@ -63,7 +63,7 @@ public ManagementListStateDescriptor(string name) /// public override void SaveState(ManagementList subject) { - if (null == subject) + if (subject == null) { throw new ArgumentNullException("subject"); } @@ -100,7 +100,7 @@ public override void RestoreState(ManagementList subject) /// public void RestoreState(ManagementList subject, bool applyRestoredFilter) { - if (null == subject) + if (subject == null) { throw new ArgumentNullException("subject"); } @@ -129,7 +129,7 @@ private static bool VerifyColumnsSavable(ManagementList subject, RetryActionCall return false; } - if (null == subject.List.InnerGrid) + if (subject.List.InnerGrid == null) { return false; } @@ -158,7 +158,7 @@ private static bool VerifyColumnsRestorable(ManagementList subject, RetryActionC return false; } - if (null == subject.List) + if (subject.List == null) { return false; } @@ -179,17 +179,17 @@ private static bool VerifyRulesSavableAndRestorable(ManagementList subject, Retr return false; } - if (null == subject.AddFilterRulePicker) + if (subject.AddFilterRulePicker == null) { return false; } - if (null == subject.FilterRulePanel) + if (subject.FilterRulePanel == null) { return false; } - if (null == subject.SearchBox) + if (subject.SearchBox == null) { return false; } @@ -387,7 +387,7 @@ private void SaveSortOrder(ManagementList subject) } else { - this.sortOrderPropertyName = String.Empty; + this.sortOrderPropertyName = string.Empty; } } @@ -400,7 +400,7 @@ private void RestoreSortOrder(ManagementList subject) subject.List.ClearSort(); - if (!String.IsNullOrEmpty(this.sortOrderPropertyName)) + if (!string.IsNullOrEmpty(this.sortOrderPropertyName)) { foreach (InnerListColumn column in subject.List.Columns) { @@ -567,11 +567,11 @@ public int Compare(InnerListColumn x, InnerListColumn y) { return 0; } - else if (null == x) + else if (x == null) { return -1; } - else if (null == y) + else if (y == null) { return 1; } @@ -581,7 +581,7 @@ public int Compare(InnerListColumn x, InnerListColumn y) this.columns.TryGetValue(x.DataDescription.PropertyName, out csdX); this.columns.TryGetValue(y.DataDescription.PropertyName, out csdY); - if (null == csdX || null == csdY || false == (csdX.IsInUse && csdX.IsInUse)) + if (csdX == null || csdY == null || (csdX.IsInUse && csdX.IsInUse) == false) { return 0; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListTitle.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListTitle.Generated.cs index dc7dbfdd73c..571ca76df1b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListTitle.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListTitle.Generated.cs @@ -71,7 +71,7 @@ protected virtual void OnListChanged(PropertyChangedEventArgs e) /// /// Identifies the ListStatus dependency property. /// - public static readonly DependencyProperty ListStatusProperty = DependencyProperty.Register( "ListStatus", typeof(string), typeof(ManagementListTitle), new PropertyMetadata( String.Empty, ListStatusProperty_PropertyChanged) ); + public static readonly DependencyProperty ListStatusProperty = DependencyProperty.Register( "ListStatus", typeof(string), typeof(ManagementListTitle), new PropertyMetadata( string.Empty, ListStatusProperty_PropertyChanged) ); /// /// Gets the status of the list. This is a dependency property. @@ -120,7 +120,7 @@ protected virtual void OnListStatusChanged(PropertyChangedEventArgs e) /// /// Identifies the Title dependency property. /// - public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( "Title", typeof(string), typeof(ManagementListTitle), new PropertyMetadata( String.Empty, TitleProperty_PropertyChanged) ); + public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( "Title", typeof(string), typeof(ManagementListTitle), new PropertyMetadata( string.Empty, TitleProperty_PropertyChanged) ); /// /// Gets or sets the title. This is a dependency property. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs index a10435d15c9..5a8c829e94a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs @@ -42,18 +42,18 @@ public virtual bool TryGetPropertyValue(string propertyName, object value, out o { propertyValue = null; - if (String.IsNullOrEmpty(propertyName)) + if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentException("propertyName is empty", "propertyName"); } - if (null == value) + if (value == null) { throw new ArgumentNullException("value"); } PropertyDescriptor descriptor = this.GetPropertyDescriptor(propertyName, value); - if (null == descriptor) + if (descriptor == null) { return false; } @@ -91,7 +91,7 @@ private PropertyDescriptor GetPropertyDescriptor(string propertyName, object val PropertyDescriptor descriptor; - if (null == propertyRow) + if (propertyRow == null) { PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ViewGroupToStringConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ViewGroupToStringConverter.cs index ab56b6d8027..24d737f2883 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ViewGroupToStringConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ViewGroupToStringConverter.cs @@ -29,13 +29,13 @@ internal class ViewGroupToStringConverter : IValueConverter public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { CollectionViewGroup cvg = value as CollectionViewGroup; - if (null == cvg) + if (cvg == null) { throw new ArgumentException("value must be of type CollectionViewGroup", "value"); } - string name = (!String.IsNullOrEmpty(cvg.Name.ToString())) ? cvg.Name.ToString() : UICultureResources.GroupTitleNone; - string display = String.Format(CultureInfo.CurrentCulture, "{0} ({1})", name, cvg.ItemCount); + string name = (!string.IsNullOrEmpty(cvg.Name.ToString())) ? cvg.Name.ToString() : UICultureResources.GroupTitleNone; + string display = string.Format(CultureInfo.CurrentCulture, "{0} ({1})", name, cvg.ItemCount); return display; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs index 0122845b34b..4e21fda73ce 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs @@ -40,7 +40,7 @@ public IStateDescriptorFactory SavedViewFactory { get { - if (null == this.savedViewFactory) + if (this.savedViewFactory == null) { this.savedViewFactory = new ManagementListStateDescriptorFactory(); } @@ -50,7 +50,7 @@ public IStateDescriptorFactory SavedViewFactory set { - if (null == value) + if (value == null) { throw new ArgumentNullException("value"); } @@ -246,7 +246,7 @@ public void ResetView() this.defaultFullTextSearchRule.PropertyNames.Clear(); this.AddFilterRulePicker.ShortcutFilterRules.Clear(); this.AddFilterRulePicker.ColumnFilterRules.Clear(); - this.SearchBox.Text = String.Empty; + this.SearchBox.Text = string.Empty; this.SearchBox.Parser.ClearSearchableRules(); this.SearchBox.Parser.FullTextRule = this.defaultFullTextSearchRule; } @@ -311,7 +311,7 @@ partial void OnClearFilterExecutedImplementation(ExecutedRoutedEventArgs e) partial void OnSaveViewCanExecuteImplementation(CanExecuteRoutedEventArgs e) { string viewName = (string)e.Parameter; - bool isNotEmpty = !String.IsNullOrEmpty(viewName) && (0 != viewName.Trim().Length); + bool isNotEmpty = !string.IsNullOrEmpty(viewName) && (0 != viewName.Trim().Length); e.CanExecute = isNotEmpty; } @@ -323,7 +323,7 @@ partial void OnSaveViewExecutedImplementation(ExecutedRoutedEventArgs e) StateDescriptor sd = null; - if (null == (sd = this.DoesViewAlreadyExist(viewName))) + if ((sd = this.DoesViewAlreadyExist(viewName)) == null) { sd = this.SavedViewFactory.Create(); sd.Name = viewName; @@ -352,7 +352,7 @@ private StateDescriptor DoesViewAlreadyExist(string viewName) private void ViewManager_ItemSelected(object sender, DataRoutedEventArgs e) { - if (null == e.Data) + if (e.Data == null) { throw new ArgumentException("e.Data is null", "e"); } @@ -365,7 +365,7 @@ private void ViewManager_ItemSelected(object sender, DataRoutedEventArgs private void ViewManager_ItemDeleted(object sender, DataRoutedEventArgs e) { - if (null == e.Data) + if (e.Data == null) { throw new ArgumentException("e.Data is null", "e"); } diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs index 37b4848dec4..ef082c72881 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonToolTipConverter.cs @@ -47,9 +47,9 @@ public object Convert(object value, Type targetType, object parameter, System.Gl return toolTipObj.ToString(); } - if (imageButtonBase.Command != null && !String.IsNullOrEmpty(imageButtonBase.Command.Text)) + if (imageButtonBase.Command != null && !string.IsNullOrEmpty(imageButtonBase.Command.Text)) { - return imageButtonBase.Command.Text.Replace("_", String.Empty); + return imageButtonBase.Command.Text.Replace("_", string.Empty); } return null; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs index 2c14d5ae031..d123a08cddd 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs @@ -170,7 +170,7 @@ private static MultipleSelectionControl CreateMultiSelectComboControl(ParameterV System.Windows.Automation.AutomationProperties.NameProperty, parameterViewModel.Name); - string buttonToolTipAndName = String.Format( + string buttonToolTipAndName = string.Format( CultureInfo.CurrentUICulture, ShowCommandResources.SelectMultipleValuesForParameterFormat, parameterViewModel.Name); @@ -284,7 +284,7 @@ private void ParameterSetControl_DataContextChanged(object sender, DependencyPro { // For ValidateSet parameter ArrayList itemsSource = new ArrayList(); - itemsSource.Add(String.Empty); + itemsSource.Add(string.Empty); for (int i = 0; i < parameter.Parameter.ValidParamSetValues.Count; i++) { @@ -298,7 +298,7 @@ private void ParameterSetControl_DataContextChanged(object sender, DependencyPro if (parameter.Parameter.ParameterType.HasFlagAttribute) { ArrayList itemsSource = new ArrayList(); - itemsSource.Add(String.Empty); + itemsSource.Add(string.Empty); itemsSource.AddRange(parameter.Parameter.ParameterType.EnumValues); control = ParameterSetControl.CreateComboBoxControl(parameter, rowNumber, itemsSource); } @@ -309,7 +309,7 @@ private void ParameterSetControl_DataContextChanged(object sender, DependencyPro } else if (parameter.Parameter.ParameterType.IsBoolean) { - control = ParameterSetControl.CreateComboBoxControl(parameter, rowNumber, new string[] { String.Empty, "$True", "$False" }); + control = ParameterSetControl.CreateComboBoxControl(parameter, rowNumber, new string[] { string.Empty, "$True", "$False" }); } else { diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs index 3b53366dc73..52a0eb7adc6 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs @@ -159,7 +159,7 @@ public double ZoomLevel /// public static string RefreshTooltip { - get { return String.Format(CultureInfo.CurrentUICulture, ShowCommandResources.RefreshShowCommandTooltipFormat, "import-module"); } + get { return string.Format(CultureInfo.CurrentUICulture, ShowCommandResources.RefreshShowCommandTooltipFormat, "import-module"); } } /// @@ -570,7 +570,7 @@ private int Compare(ModuleViewModel source, ModuleViewModel target) return 1; } - return String.Compare(source.Name, target.Name, StringComparison.OrdinalIgnoreCase); + return string.Compare(source.Name, target.Name, StringComparison.OrdinalIgnoreCase); } /// diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs index 834eb5fd1c1..21e1b521811 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs @@ -356,7 +356,7 @@ public string ToolTip { get { - return String.Format( + return string.Format( CultureInfo.CurrentCulture, ShowCommandResources.CmdletTooltipFormat, this.Name, @@ -372,7 +372,7 @@ public string ImportModuleMessage { get { - return String.Format( + return string.Format( CultureInfo.CurrentCulture, ShowCommandResources.NotImportedFormat, this.ModuleName, @@ -390,14 +390,14 @@ public string DetailsTitle { if (this.IsImported) { - return String.Format( + return string.Format( CultureInfo.CurrentCulture, ShowCommandResources.DetailsParameterTitleFormat, this.Name); } else { - return String.Format( + return string.Format( CultureInfo.CurrentCulture, ShowCommandResources.NameLabelFormat, this.Name); @@ -424,7 +424,7 @@ public string GetScript() string commandName = this.commandInfo.CommandType == CommandTypes.ExternalScript ? this.commandInfo.Definition : this.Name; - if (this.ModuleQualifyCommandName && !String.IsNullOrEmpty(this.ModuleName)) + if (this.ModuleQualifyCommandName && !string.IsNullOrEmpty(this.ModuleName)) { commandName = this.ModuleName + "\\" + commandName; } @@ -534,7 +534,7 @@ internal static CommandViewModel GetCommandViewModel(ModuleViewModel module, Sho } List commonParametersList = commonParametersTable.Values.ToList(); - returnValue.comonParameters = new ParameterSetViewModel(String.Empty, commonParametersList); + returnValue.comonParameters = new ParameterSetViewModel(string.Empty, commonParametersList); returnValue.parameterSets.Sort(returnValue.Compare); @@ -612,7 +612,7 @@ private int Compare(ParameterSetViewModel source, ParameterSetViewModel target) } } - return String.Compare(source.Name, target.Name, StringComparison.Ordinal); + return string.Compare(source.Name, target.Name, StringComparison.Ordinal); } /// diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs index 2dad74c2649..6b62b01d000 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs @@ -128,7 +128,7 @@ public string DisplayName { get { - if (!String.IsNullOrEmpty(this.name)) + if (!string.IsNullOrEmpty(this.name)) { return this.name; } @@ -330,7 +330,7 @@ internal void SortCommands(bool markRepeatedCmdlets) internal void RefreshFilteredCommands(string filter) { this.filteredCommands.Clear(); - if (String.IsNullOrEmpty(filter)) + if (string.IsNullOrEmpty(filter)) { foreach (CommandViewModel command in this.Commands) { @@ -511,7 +511,7 @@ private void SetIsThereASelectedImportedCommandWhereAllMandatoryParametersHaveVa /// return compare result private int Compare(CommandViewModel source, CommandViewModel target) { - return String.Compare(source.Name, target.Name, StringComparison.OrdinalIgnoreCase); + return string.Compare(source.Name, target.Name, StringComparison.OrdinalIgnoreCase); } #endregion diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs index 40ed0a0029f..886efa12165 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs @@ -226,7 +226,7 @@ internal static int Compare(ParameterViewModel source, ParameterViewModel target return 1; } - return String.Compare(source.Parameter.Name, target.Parameter.Name); + return string.Compare(source.Parameter.Name, target.Parameter.Name); } #endregion diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs index e27c39f49db..bab5f1636fc 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs @@ -67,7 +67,7 @@ public ParameterViewModel(ShowCommandParameterInfo parameter, string parameterSe } else { - this.parameterValue = String.Empty; + this.parameterValue = string.Empty; } } #endregion @@ -143,12 +143,12 @@ public string NameTextLabel get { return this.Parameter.IsMandatory ? - String.Format( + string.Format( CultureInfo.CurrentUICulture, ShowCommandResources.MandatoryNameLabelFormat, this.Name, ShowCommandResources.MandatoryLabelSegment) : - String.Format( + string.Format( CultureInfo.CurrentUICulture, ShowCommandResources.NameLabelFormat, this.Name); @@ -229,7 +229,7 @@ public bool HasValue /// the tooltip based on the parameters internal static string EvaluateTooltip(string typeName, int position, bool mandatory, bool shared, bool valueFromPipeline) { - StringBuilder returnValue = new StringBuilder(String.Format( + StringBuilder returnValue = new StringBuilder(string.Format( CultureInfo.CurrentCulture, ShowCommandResources.TypeFormat, typeName)); @@ -237,7 +237,7 @@ internal static string EvaluateTooltip(string typeName, int position, bool manda if (position >= 0) { - string positionFormat = String.Format( + string positionFormat = string.Format( CultureInfo.CurrentCulture, ShowCommandResources.PositionFormat, position); diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs index 68dd7ebd37e..7d3d502e901 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs @@ -69,7 +69,7 @@ public ShowAllModulesWindow() } catch (NotSupportedException) { - //localized has a problematic string - going to default + // localized has a problematic string - going to default plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Add")); plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Plus")); CommandBindings.Add(new CommandBinding(plusSettings, ZoomEventHandlerPlus)); @@ -88,7 +88,7 @@ public ShowAllModulesWindow() } catch (NotSupportedException) { - //localized has a problematic string - going to default + // localized has a problematic string - going to default minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Subtract")); minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Minus")); CommandBindings.Add(new CommandBinding(minusSettings, ZoomEventHandlerMinus)); @@ -168,7 +168,7 @@ private void ZoomEventHandlerPlus(object sender, ExecutedRoutedEventArgs e) if (this.zoomLevel < ZOOM_MAX) { - //ViewModel applies ZoomLevel after dividing it by 100, So multiply it by 100 and then later reset to normal by dividing for next zoom + // ViewModel applies ZoomLevel after dividing it by 100, So multiply it by 100 and then later reset to normal by dividing for next zoom this.zoomLevel = ((this.zoomLevel + ZOOM_INCREMENT) * 100); viewModel.ZoomLevel = this.zoomLevel; this.zoomLevel /= 100; @@ -190,7 +190,7 @@ private void ZoomEventHandlerMinus(object sender, ExecutedRoutedEventArgs e) if (this.zoomLevel >= ZOOM_MIN) { - //ViewModel applies ZoomLevel after dividing it by 100, So multiply it by 100 and then later reset to normal by dividing it for next zoom + // ViewModel applies ZoomLevel after dividing it by 100, So multiply it by 100 and then later reset to normal by dividing it for next zoom this.zoomLevel = ((this.zoomLevel - ZOOM_INCREMENT) * 100); viewModel.ZoomLevel = this.zoomLevel; this.zoomLevel /= 100; diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/HelpWindowHelper.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/HelpWindowHelper.cs index 70c4f003d15..3a7fbd61d3a 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/HelpWindowHelper.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/HelpWindowHelper.cs @@ -38,7 +38,7 @@ private static void ShowHelpWindow(PSObject helpObj, PSCmdlet cmdlet) helpWindow.Closed += new EventHandler(delegate(object sender, EventArgs e) { ownerWindow.Focus(); }); }), - String.Empty); + string.Empty); return; } diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs index 47534883012..d3d75e7cb97 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs @@ -155,7 +155,7 @@ private void StartWindow(string invocation, string outputModeOptions, AutoResetE } catch (NotSupportedException) { - //localized has a problematic string - going to default + // localized has a problematic string - going to default plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Add")); plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Plus")); this.gridViewWindow.CommandBindings.Add(new CommandBinding(plusSettings, ZoomEventHandlerPlus)); @@ -173,7 +173,7 @@ private void StartWindow(string invocation, string outputModeOptions, AutoResetE } catch (NotSupportedException) { - //localized has a problematic string - going to default + // localized has a problematic string - going to default minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Subtract")); minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Minus")); this.gridViewWindow.CommandBindings.Add(new CommandBinding(minusSettings, ZoomEventHandlerMinus)); diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs index 1793dee45e2..9144bdcac5a 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs @@ -482,10 +482,13 @@ internal static string GetShowAllModulesCommand(bool isRemoteRunspace = false, b /// String representation of the script for Get-SerializedCommand private static string GetSerializedCommandScript() { - return string.Format(CultureInfo.InvariantCulture, "@({0};{1};{2})", + return string.Format( + CultureInfo.InvariantCulture, + "@({0};{1};{2})", ScriptGetSerializedCommand, @"PSGetSerializedShowCommandInfo", - @"Remove-Item -Path 'function:\PSGetSerializedShowCommandInfo' -Force"); + @"Remove-Item -Path 'function:\PSGetSerializedShowCommandInfo' -Force" + ); } @@ -634,7 +637,7 @@ internal static AllModulesViewModel GetNewAllModulesViewModel(AllModulesViewMode } AllModulesViewModel returnValue = new AllModulesViewModel(importedModules, commands, oldViewModel.NoCommonParameter); - if (!String.IsNullOrEmpty(oldFilter)) + if (!string.IsNullOrEmpty(oldFilter)) { returnValue.CommandNameFilter = oldFilter; } @@ -682,7 +685,7 @@ internal static AllModulesViewModel GetNewAllModulesViewModel(AllModulesViewMode /// an error message to be displayed when failed to import a module internal static string GetImportModuleFailedMessage(string command, string module, string error) { - return String.Format( + return string.Format( CultureInfo.CurrentUICulture, ShowCommandResources.ImportModuleFailedFormat, command, @@ -699,7 +702,7 @@ internal static string SingleQuote(string str) { if (str == null) { - str = String.Empty; + str = string.Empty; } return "\'" + System.Management.Automation.Language.CodeGeneration.EscapeSingleQuotedStringContent(str) + "\'"; @@ -847,8 +850,8 @@ private static string GetShowCommandCommand(string commandName, bool includeAlia { string quotedCommandName = ShowCommandHelper.SingleQuote(commandName); return "@(get-command " + quotedCommandName + " " + ShowCommandHelper.CommandTypeSegment + - (includeAliasAndModules ? ",Alias" : String.Empty) + ")" + - (includeAliasAndModules ? ShowCommandHelper.GetGetModuleSuffix() : String.Empty); + (includeAliasAndModules ? ",Alias" : string.Empty) + ")" + + (includeAliasAndModules ? ShowCommandHelper.GetGetModuleSuffix() : string.Empty); } /// @@ -880,7 +883,7 @@ private static void ActivateWindow(Window window) { window.Activate(); }), - String.Empty); + string.Empty); } /// @@ -945,7 +948,7 @@ private void CallShowDialog(PSCmdlet cmdlet) childWindow.Owner = this.hostWindow; childWindow.Show(); }), - String.Empty); + string.Empty); } /// @@ -1018,7 +1021,7 @@ private void ImportModuleDone(Dictionary imported this.commandNeedingImportModule); this.SetupViewModel(); }), - String.Empty); + string.Empty); } } @@ -1042,7 +1045,7 @@ private void ImportModuleFailed(Exception reason) reason.Message); MessageBox.Show(this.window, message, ShowCommandResources.ShowCommandError, MessageBoxButton.OK, MessageBoxImage.Error); }), - String.Empty); + string.Empty); } } @@ -1063,7 +1066,7 @@ private void DisplayHelp(Collection getHelpResults) help.Owner = this.window; help.Show(); }), - String.Empty); + string.Empty); } } @@ -1218,7 +1221,7 @@ private void Buttons_RunClick(object sender, RoutedEventArgs e) } /// - /// Closes the window + /// Closes the window. /// /// event sender /// event arguments @@ -1228,7 +1231,7 @@ private void Buttons_CancelClick(object sender, RoutedEventArgs e) } /// - /// closes the window + /// closes the window. /// private void CloseWindow() { @@ -1250,13 +1253,13 @@ private void CloseWindow() /// /// Showing a MessageBox when user type a invalidate command name. /// - /// error message + /// Error message. private void ShowErrorString(string errorString) { if (errorString != null && errorString.Trim().Length > 0) { MessageBox.Show( - String.Format( + string.Format( CultureInfo.CurrentUICulture, ShowCommandResources.EndProcessingErrorMessage, errorString), diff --git a/src/ResGen/Program.cs b/src/ResGen/Program.cs index 8ae3d09937c..f07b992484d 100644 --- a/src/ResGen/Program.cs +++ b/src/ResGen/Program.cs @@ -52,7 +52,7 @@ public static void Main(string[] args) if (className.StartsWith("public.", StringComparison.InvariantCultureIgnoreCase)) { accessModifier = "public"; - className = className.Substring(className.IndexOf(".")+1); + className = className.Substring(className.IndexOf(".") + 1); } string sourceCode = GetStronglyTypeCsFileForResx(resxPath, moduleName, className, accessModifier); @@ -71,7 +71,6 @@ private static string GetStronglyTypeCsFileForResx(string xmlPath, string module // className = Full.Name.Of.The.ClassFoo // shortClassName = ClassFoo // namespaceName = Full.Name.Of.The - string shortClassName = className; string namespaceName = null; int lastIndexOfDot = className.LastIndexOf('.'); @@ -90,7 +89,7 @@ private static string GetStronglyTypeCsFileForResx(string xmlPath, string module entries.AppendFormat(ENTRY, name, value, accessModifier); } - string bodyCode = string.Format(BODY, shortClassName, moduleName, entries.ToString(), className, accessModifier, accessModifier.Equals("public", StringComparison.InvariantCultureIgnoreCase) ? "public." : ""); + string bodyCode = string.Format(BODY, shortClassName, moduleName, entries.ToString(), className, accessModifier, accessModifier.Equals("public", StringComparison.InvariantCultureIgnoreCase) ? "public." : string.Empty); if (namespaceName != null) { bodyCode = string.Format(NAMESPACE, namespaceName, bodyCode); @@ -119,6 +118,7 @@ namespace {0} {{ {1} }} "; + private static readonly string BODY = @" using System; using System.Reflection; @@ -185,6 +185,5 @@ namespace {0} {{ }} }} "; - } } diff --git a/src/System.Management.Automation/help/HelpCommands.cs b/src/System.Management.Automation/help/HelpCommands.cs index ee7af8d412f..c666cae6402 100644 --- a/src/System.Management.Automation/help/HelpCommands.cs +++ b/src/System.Management.Automation/help/HelpCommands.cs @@ -205,8 +205,9 @@ public SwitchParameter Online #if !UNIX private GraphicalHostReflectionWrapper graphicalHostReflectionWrapper; private bool showWindow; + /// - /// Gets and sets a value indicating whether the help should be displayed in a separate window + /// Gets or sets a value indicating whether the help should be displayed in a separate window. /// [Parameter(ParameterSetName = "ShowWindow", Mandatory = true)] public SwitchParameter ShowWindow @@ -269,7 +270,7 @@ protected override void ProcessRecord() try { #if !UNIX - if(this.ShowWindow) + if (this.ShowWindow) { this.graphicalHostReflectionWrapper = GraphicalHostReflectionWrapper.GetGraphicalHostReflectionWrapper(this, "Microsoft.PowerShell.Commands.Internal.HelpWindowHelper"); } From d2ce8a70f6e43ff65ed312217d7ba4d330065d0c Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Fri, 25 Oct 2019 16:45:01 -0700 Subject: [PATCH 11/22] fix default commands test --- test/powershell/engine/Basic/DefaultCommands.Tests.ps1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 index 67486225871..0b0aabff5af 100644 --- a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 +++ b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 @@ -125,7 +125,7 @@ Describe "Verify approved aliases list" -Tags "CI" { "Alias", "nsn", "New-PSSession", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "" "Alias", "nv", "New-Variable", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", "", "" "Alias", "nwsn", "New-PSWorkflowSession", $($FullCLR ), "ReadOnly", "", "" -"Alias", "ogv", "Out-GridView", $($FullCLR ), "ReadOnly", "", "" +"Alias", "ogv", "Out-GridView", $($FullCLR -or $CoreWindows ), "ReadOnly", "", "" "Alias", "oh", "Out-Host", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", "", "" "Alias", "popd", "Pop-Location", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "AllScope", "" "Alias", "ps", "Get-Process", $($FullCLR -or $CoreWindows ), "", "", "" @@ -161,7 +161,7 @@ Describe "Verify approved aliases list" -Tags "CI" { "Alias", "scb", "Set-Clipboard", $($FullCLR ), "ReadOnly", "", "" "Alias", "select", "Select-Object", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", "AllScope", "" "Alias", "set", "Set-Variable", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "" -"Alias", "shcm", "Show-Command", $($FullCLR ), "ReadOnly", "", "" +"Alias", "shcm", "Show-Command", $($FullCLR -or $CoreWindows ), "ReadOnly", "", "" "Alias", "si", "Set-Item", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", "", "" "Alias", "sl", "Set-Location", $($FullCLR -or $CoreWindows -or $CoreUnix), "ReadOnly", "", "" "Alias", "sleep", "Start-Sleep", $($FullCLR -or $CoreWindows ), "ReadOnly", "", "" @@ -368,7 +368,7 @@ Describe "Verify approved aliases list" -Tags "CI" { "Cmdlet", "New-WSManSessionOption", "", $($FullCLR -or $CoreWindows ), "", "", "None" "Cmdlet", "Out-Default", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" "Cmdlet", "Out-File", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" -"Cmdlet", "Out-GridView", "", $($FullCLR ), "", "", "" +"Cmdlet", "Out-GridView", "", $($FullCLR -or $CoreWindows ), "", "", "" "Cmdlet", "Out-Host", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" "Cmdlet", "Out-LineOutput", "", $($FullCLR ), "", "", "" "Cmdlet", "Out-Null", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" @@ -439,7 +439,7 @@ Describe "Verify approved aliases list" -Tags "CI" { "Cmdlet", "Set-WmiInstance", "", $($FullCLR ), "", "", "" "Cmdlet", "Set-WSManInstance", "", $($FullCLR -or $CoreWindows ), "", "", "None" "Cmdlet", "Set-WSManQuickConfig", "", $($FullCLR -or $CoreWindows ), "", "", "None" -"Cmdlet", "Show-Command", "", $($FullCLR ), "", "", "" +"Cmdlet", "Show-Command", "", $($FullCLR -or $CoreWindows ), "", "", "" "Cmdlet", "Show-ControlPanelItem", "", $($FullCLR ), "", "", "" "Cmdlet", "Show-EventLog", "", $($FullCLR ), "", "", "" "Cmdlet", "Show-Markdown", "", $( $CoreWindows -or $CoreUnix), "", "", "None" From 30a4c9711786ba48962c5e15b21b82f1aaea2b20 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Fri, 25 Oct 2019 16:59:43 -0700 Subject: [PATCH 12/22] codefactor: space after `if` and remove multiple newlines --- .../HelpWindow/HelpParagraphBuilder.cs | 2 +- .../Common/DismissiblePopup.Generated.cs | 2 +- .../ManagementList/Common/DismissiblePopup.cs | 1 - .../Common/ListOrganizer.Generated.cs | 2 +- .../Common/ListOrganizerItem.Generated.cs | 2 +- .../Common/MessageTextBox.Generated.cs | 2 +- .../ManagementList/Common/MessageTextBox.cs | 1 - .../ManagementList/Common/PickerBase.Generated.cs | 2 +- .../Common/PopupControlButton.Generated.cs | 2 +- .../Common/ScalableImage.Generated.cs | 2 +- .../Common/ScalableImageSource.Generated.cs | 2 +- .../CommonControls/Resizer.Generated.cs | 2 +- .../ManagementList/CommonControls/Resizer.cs | 1 - .../CommonControls/UIElementAdorner.Generated.cs | 2 +- .../FilterCore/FilterRules/SelectorFilterRule.cs | 1 - .../AddFilterRulePicker.Generated.cs | 2 +- .../FilterProviders/SearchBox.Generated.cs | 2 +- .../ManagementList/InnerList.Generated.cs | 2 +- .../ManagementList/ManagementList.Generated.cs | 2 +- .../ManagementList/ManagementListTitle.Generated.cs | 2 +- .../ManagementList/PropertyValueComparer.cs | 1 - .../ManagementList/innerlistcolumn.cs | 2 -- .../Controls/ParameterSetControl.xaml.cs | 2 +- .../ShowCommand/ViewModel/ParameterSetViewModel.cs | 2 +- .../Windows/ShowAllModulesWindow.xaml.cs | 1 - .../commandHelpers/OutGridView.cs | 11 +++++------ .../commandHelpers/ShowCommandHelper.cs | 13 +++++-------- 27 files changed, 28 insertions(+), 40 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs index f0a23603147..18cf5cf341b 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs @@ -558,7 +558,7 @@ private void AddExamples(bool setting, string sectionTitle) private void AddMembers(bool setting, string sectionTitle) { - if(!setting || string.IsNullOrEmpty(sectionTitle)) + if (!setting || string.IsNullOrEmpty(sectionTitle)) { return; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.Generated.cs index c0a89bc1c41..1eb1d456389 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.Generated.cs @@ -247,7 +247,7 @@ protected virtual void OnSetFocusOnCloseElementChanged(PropertyChangedEventArgs< /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs index 10ec3f10931..ebf84dd62b2 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs @@ -46,7 +46,6 @@ protected override void OnOpened(EventArgs e) this.SetupAutomationIdBinding(); } - /// /// Responds when the value of the IsOpen property changes from to true to false. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.Generated.cs index 7dbebad8d2a..8b31f700a12 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.Generated.cs @@ -440,7 +440,7 @@ protected virtual void OnTextContentPropertyNameChanged(PropertyChangedEventArgs /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.Generated.cs index 098bf384b83..15f5efdff34 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.Generated.cs @@ -103,7 +103,7 @@ protected virtual void OnTextContentPropertyNameChanged(PropertyChangedEventArgs /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.Generated.cs index 48f93589328..b764ed81355 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.Generated.cs @@ -122,7 +122,7 @@ protected virtual void OnIsBackgroundTextShownChanged(PropertyChangedEventArgs private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs index 46a4c4e5f24..aa6d4db4836 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs @@ -9,7 +9,6 @@ namespace Microsoft.Management.UI.Internal { - /// /// Partial class implementation for MessageTextBox control. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.Generated.cs index 9939bdf1553..c87820941c6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.Generated.cs @@ -214,7 +214,7 @@ protected virtual void OnIsOpenChanged(PropertyChangedEventArgs e) /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.Generated.cs index 4bdd98394a4..291a65373d1 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.Generated.cs @@ -72,7 +72,7 @@ protected virtual void OnIsPopupOpenChanged(PropertyChangedEventArgs e) /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImage.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImage.Generated.cs index e3319903e15..319de2fed32 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImage.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImage.Generated.cs @@ -70,7 +70,7 @@ protected virtual void OnSourceChanged(PropertyChangedEventArgs private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImageSource.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImageSource.Generated.cs index 48ea9b8832c..6589de9158d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImageSource.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImageSource.Generated.cs @@ -217,7 +217,7 @@ protected virtual void OnSizeChanged(PropertyChangedEventArgs e) /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.Generated.cs index 91962ac8d65..ba25ca27655 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.Generated.cs @@ -370,7 +370,7 @@ protected virtual void OnVisibleGripWidthChanged(PropertyChangedEventArgs private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs index 7ae700d7348..cc96ece36a4 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs @@ -76,7 +76,6 @@ internal static Thickness CreateGripThickness(double visibleGripWidth, ResizeGri return thickness; } - partial void PreOnApplyTemplate() { if (this.rightGrip != null) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.Generated.cs index 551bb904da0..0d8b7ab8257 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.Generated.cs @@ -59,7 +59,7 @@ static private void ChildProperty_PropertyChanged(DependencyObject o, Dependency private void RaiseChildChanged(PropertyChangedEventArgs e) { var eh = this.ChildChanged; - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs index e3e0f0080ef..c07c049e1ee 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs @@ -113,7 +113,6 @@ private void AvailableRules_SelectedValueChanged(object sender, PropertyChangedE this.OnSelectedValueChanged(e.OldValue, e.NewValue); } - #endregion Private Methods } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.Generated.cs index 32590fd50c7..fea3c9e996d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.Generated.cs @@ -234,7 +234,7 @@ protected virtual void OnIsOpenChanged(PropertyChangedEventArgs e) /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.Generated.cs index 9d2144fc766..f864b222ab9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.Generated.cs @@ -163,7 +163,7 @@ protected virtual void OnTextChanged(PropertyChangedEventArgs e) /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerList.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerList.Generated.cs index a4d6e18f7b6..7db7d10791e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerList.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerList.Generated.cs @@ -198,7 +198,7 @@ static private void IsPrimarySortColumnProperty_PropertyChanged(DependencyObject /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementList.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementList.Generated.cs index e6357abd2d9..2627fa20884 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementList.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementList.Generated.cs @@ -786,7 +786,7 @@ protected virtual void OnViewSaverUserActionStateChanged(PropertyChangedEventArg /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListTitle.Generated.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListTitle.Generated.cs index 571ca76df1b..8becd00210b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListTitle.Generated.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListTitle.Generated.cs @@ -217,7 +217,7 @@ protected virtual void OnTotalItemCountChanged(PropertyChangedEventArgs e) /// private void RaisePropertyChangedEvent(EventHandler> eh, PropertyChangedEventArgs e) { - if(eh != null) + if (eh != null) { eh(this,e); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs index bd42afa131a..3b7208d1468 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs @@ -107,7 +107,6 @@ private int CompareData(object firstValue, object secondValue, StringComparison return -1; } - Type firstType = firstValue.GetType(); Type secondType = secondValue.GetType(); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/innerlistcolumn.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/innerlistcolumn.cs index 30523efa749..0fe0f3ed7f4 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/innerlistcolumn.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/innerlistcolumn.cs @@ -96,8 +96,6 @@ public InnerListColumn(UIPropertyGroupDescription dataDescription, bool isVisibl } #endregion constructor - - #region private methods #region private static methods diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs index d123a08cddd..4fadcfbfd9f 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs @@ -280,7 +280,7 @@ private void ParameterSetControl_DataContextChanged(object sender, DependencyPro { this.CreateAndAddLabel(parameter, rowNumber); Control control = null; - if(parameter.Parameter.HasParameterSet) + if (parameter.Parameter.HasParameterSet) { // For ValidateSet parameter ArrayList itemsSource = new ArrayList(); diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs index 886efa12165..586c9f66d79 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs @@ -163,7 +163,7 @@ public string GetScript() { parameterValueString = ParameterSetViewModel.GetDelimitedParameter(parameterValueString, "\"", "\""); } - else if(parameterType.IsScriptBlock) + else if (parameterType.IsScriptBlock) { parameterValueString = ParameterSetViewModel.GetDelimitedParameter(parameterValueString, "{", "}"); } diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs index 7d3d502e901..39b03353ee0 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs @@ -75,7 +75,6 @@ public ShowAllModulesWindow() CommandBindings.Add(new CommandBinding(plusSettings, ZoomEventHandlerPlus)); }; - RoutedCommand minusSettings = new RoutedCommand(); try { diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs index d3d75e7cb97..a31f5765141 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs @@ -91,7 +91,6 @@ internal class OutGridViewWindow /// private double zoomLevel = 1.0; - #endregion private Fields #region internal Constructors @@ -438,7 +437,7 @@ private void AddColumns(string[] propertyNames, string[] displayNames, Type[] ty bool haveTemplate = this.managementList.FilterRulePanel.TryGetContentTemplate(types[i], out dataTemplate); InnerListColumn column = null; - if(haveTemplate) + if (haveTemplate) { column = new InnerListColumn(new UIPropertyGroupDescription(propertyNames[i], displayNames[i], types[i])); } @@ -451,7 +450,7 @@ private void AddColumns(string[] propertyNames, string[] displayNames, Type[] ty this.managementList.List.SetColumnHeaderActions(); - if(this.managementList.List.ItemsSource == null) + if (this.managementList.List.ItemsSource == null) { // Setting ItemsSource implicitly regenerates all columns. this.managementList.List.ItemsSource = this.listItems; @@ -464,7 +463,7 @@ private void AddColumns(string[] propertyNames, string[] displayNames, Type[] ty catch (Exception e) { // Store the exception in a local variable that will be checked later. - if(e.InnerException != null) + if (e.InnerException != null) { this.exception = e.InnerException; } @@ -500,7 +499,7 @@ private void AddItem(PSObject value) catch (Exception e) { // Store the exception in a local variable that will be checked later. - if(e.InnerException != null) + if (e.InnerException != null) { this.exception = e.InnerException; } @@ -536,7 +535,7 @@ private Exception GetLastException() { Exception local = this.exception; - if(local != null) + if (local != null) { // Clear the caught exception. this.exception = null; diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs index 9144bdcac5a..91d5c860bb2 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/ShowCommandHelper.cs @@ -471,7 +471,6 @@ internal static string GetShowAllModulesCommand(bool isRemoteRunspace = false, b scriptBase = "@(Get-Command " + ShowCommandHelper.CommandTypeSegment + ")"; } - scriptBase += ShowCommandHelper.GetGetModuleSuffix(); return scriptBase; } @@ -487,11 +486,9 @@ private static string GetSerializedCommandScript() "@({0};{1};{2})", ScriptGetSerializedCommand, @"PSGetSerializedShowCommandInfo", - @"Remove-Item -Path 'function:\PSGetSerializedShowCommandInfo' -Force" - ); + @"Remove-Item -Path 'function:\PSGetSerializedShowCommandInfo' -Force"); } - /// /// Gets the command to be run to in order to import a module and refresh the command data /// @@ -556,7 +553,7 @@ internal static Dictionary GetImportedModulesDict // It is probably an issue somewhere else that a module would show up twice in the list, but we want to avoid // throwing an exception regarding that in returnValue.Add - if(!returnValue.ContainsKey(wrappedModule.Name)) + if (!returnValue.ContainsKey(wrappedModule.Name)) { returnValue.Add(wrappedModule.Name, wrappedModule); } @@ -576,14 +573,14 @@ internal static List GetCommandList(object[] commandObje foreach (PSObject rawCommand in commandObjects) { CommandInfo command = rawCommand.BaseObject as CommandInfo; - if(command != null) + if (command != null) { returnValue.Add(new ShowCommandCommandInfo(command)); } else { PSObject obj = rawCommand as PSObject; - if(obj != null) + if (obj != null) { returnValue.Add(new ShowCommandCommandInfo(obj)); } @@ -601,7 +598,7 @@ internal static List GetCommandList(object[] commandObje internal static object[] ObjectArrayFromObjectCollection(object commandObjects) { object[] objectArray = commandObjects as object[]; - if(objectArray == null) + if (objectArray == null) { objectArray = ((System.Collections.ArrayList)commandObjects).ToArray(); } From a3f413a3524121305512cf8fb769581c27e75661 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Fri, 25 Oct 2019 17:38:21 -0700 Subject: [PATCH 13/22] more codefactor fixes and ConfirmImpact test fix --- .../HelpWindow/HelpParagraphBuilder.cs | 2 +- .../ManagementList/Common/BooleanBoxes.cs | 2 -- .../ManagementList/Common/CommandHelper.cs | 1 - .../ManagementList/Common/DismissiblePopup.cs | 6 +++--- .../ManagementList/Common/IntegralConverter.cs | 3 +-- .../ManagementList/Common/IsNotNullConverter.cs | 1 - .../ManagementList/Common/ListOrganizerItem.cs | 2 +- .../ManagementList/Common/MessageTextBox.cs | 2 -- .../ManagementList/Common/WpfHelp.cs | 3 +-- .../ManagementList/CommonControls/Resizer.cs | 4 ++-- .../CommonControls/ResizerGripThicknessConverter.cs | 2 +- .../ManagementList/CommonControls/UIElementAdorner.cs | 1 - .../ManagementList/FilterCore/FilterEvaluator.cs | 2 ++ .../ManagementList/FilterCore/FilterRules/FilterRule.cs | 2 +- .../FilterRules/PropertyValueSelectorFilterRule.cs | 1 - .../FilterRules/SingleValueComparableValueFilterRule.cs | 1 - .../ManagementList/FilterCore/FilterRules/TextFilterRule.cs | 2 ++ .../FilterCore/FilterRules/TextStartsWithFilterRule.cs | 1 - .../ManagementList/FilterCore/ValidatingSelectorValue.cs | 2 +- .../ManagementList/FilterCore/ValidatingValue.cs | 1 - .../ManagementList/FilterCore/ValidatingValueBase.cs | 1 - .../ValidationRules/DataErrorInfoValidationResult.cs | 3 ++- .../FilterProviders/FilterRulePanelController.cs | 3 +-- .../FilterProviders/FilterRuleToDisplayNameConverter.cs | 1 - .../FilterProviders/InputFieldBackgroundTextConverter.cs | 1 - .../ManagementList/FilterProviders/SearchBox.cs | 1 + .../ValidatingValueToGenericParameterTypeConverter.cs | 1 - .../ManagementList/ManagementList/DefaultStringConverter.cs | 1 - .../ManagementList/ManagementList/InnerListGridView.cs | 1 - .../ManagementList/ManagementList/PropertyValueComparer.cs | 1 - .../ManagementList/UIPropertyGroupDescription.cs | 1 + .../ManagementList/ManagementList/managementlist.cs | 1 - .../ShowCommand/Controls/AllModulesControl.xaml.cs | 3 ++- .../ShowCommand/ViewModel/AllModulesViewModel.cs | 2 +- .../ShowCommand/ViewModel/CommandViewModel.cs | 5 ++--- .../ShowCommand/Windows/ShowAllModulesWindow.xaml.cs | 3 --- .../commandHelpers/OutGridView.cs | 5 ++--- test/powershell/engine/Basic/DefaultCommands.Tests.ps1 | 2 +- 38 files changed, 29 insertions(+), 48 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs index 18cf5cf341b..dfed9a66514 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs @@ -84,7 +84,7 @@ internal void AddTextToParagraphBuilder() if (string.Compare(strCategory, "DscResource", StringComparison.OrdinalIgnoreCase) == 0) { - category = HelpCategory.DscResource; + category = HelpCategory.DscResource; } else if (string.Compare(strCategory, "Class", StringComparison.OrdinalIgnoreCase) == 0) { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/BooleanBoxes.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/BooleanBoxes.cs index f20d6314860..1b42a5c5584 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/BooleanBoxes.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/BooleanBoxes.cs @@ -3,7 +3,6 @@ namespace Microsoft.Management.UI.Internal { - /// /// A class which returns the same boxed bool values. /// @@ -40,5 +39,4 @@ internal static object Box(bool value) } } } - } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CommandHelper.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CommandHelper.cs index 9399d14d8c3..6452a022fc5 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CommandHelper.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CommandHelper.cs @@ -48,4 +48,3 @@ internal static bool CanExecuteCommand(ICommand command, object parameter, IInpu } } } - diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs index ebf84dd62b2..22ea875aba8 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs @@ -107,12 +107,12 @@ private FrameworkElement FindPopupRoot() while (false == element.GetType().Name.Equals("PopupRoot", StringComparison.Ordinal)) { - element = VisualTreeHelper.GetParent( element ); + element = VisualTreeHelper.GetParent(element); } - Debug.Assert(element != null ); + Debug.Assert(element != null); - return (FrameworkElement) element; + return (FrameworkElement)element; } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs index 1aa783316e7..bf01859eb9e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs @@ -47,7 +47,7 @@ public object Convert(object[] values, Type targetType, object parameter, System return DependencyProperty.UnsetValue; } - var source = (double) values[0]; + var source = (double)values[0]; var factor = (double)values[1]; double padding = 0; @@ -68,7 +68,6 @@ public object Convert(object[] values, Type targetType, object parameter, System var result = newSource - remainder; return result; - } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs index dccec8ff406..d8891340ac7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs @@ -6,7 +6,6 @@ namespace Microsoft.Management.UI.Internal { - /// /// The IsNotNullConverter is responsible for converting a value into /// a boolean indicting whether the value is not null. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs index 8a80a338451..109db188883 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs @@ -156,7 +156,7 @@ private void ChangeFromEditToDisplayMode() // on the rename button causes the the edit box to change and // then have re-toggle. DependencyObject d = Mouse.DirectlyOver as DependencyObject; - if (d ==null || !(this.renameButton.IsAncestorOf(d) && Mouse.LeftButton == MouseButtonState.Pressed)) + if (d == null || !(this.renameButton.IsAncestorOf(d) && Mouse.LeftButton == MouseButtonState.Pressed)) { this.renameButton.IsChecked = false; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs index aa6d4db4836..89a6288b03d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/MessageTextBox.cs @@ -8,7 +8,6 @@ namespace Microsoft.Management.UI.Internal { - /// /// Partial class implementation for MessageTextBox control. /// @@ -56,4 +55,3 @@ private static object OnTextBoxTextCoerce(DependencyObject o, object baseValue) #endregion Non-Public Methods } } - diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs index 4ff710825b1..73f1c03194e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs @@ -299,7 +299,6 @@ public static T GetVisualChild(DependencyObject obj) where T : DependencyObje return null; } - /// /// Finds all children of type within the specified object's visual tree. /// @@ -468,7 +467,7 @@ public static T GetOptionalTemplateChild(Control templateParent, string child /// The reference to the child. public static T GetTemplateChild(Control templateParent, string childName) where T : FrameworkElement { - T item = GetOptionalTemplateChild( templateParent, childName ); + T item = GetOptionalTemplateChild(templateParent, childName); if (item == null) { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs index cc96ece36a4..d254c2af0c3 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs @@ -53,7 +53,7 @@ internal static Thickness CreateGripThickness(double visibleGripWidth, ResizeGri if (visibleGripWidth < 0.0 || Double.IsNaN(visibleGripWidth)) { - throw new ArgumentOutOfRangeException("visibleGripWidth", "The value must be greater than or equal to 0." ); + throw new ArgumentOutOfRangeException("visibleGripWidth", "The value must be greater than or equal to 0."); } if (Double.IsInfinity(visibleGripWidth)) @@ -70,7 +70,7 @@ internal static Thickness CreateGripThickness(double visibleGripWidth, ResizeGri thickness = new Thickness(visibleGripWidth, 0, 0, 0); break; default: - throw new InvalidEnumArgumentException("gripLocation", (int) gripLocation, typeof(ResizeGripLocation)); + throw new InvalidEnumArgumentException("gripLocation", (int)gripLocation, typeof(ResizeGripLocation)); } return thickness; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs index 5939c963a7b..d1565c2f9f5 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs @@ -64,7 +64,7 @@ public object Convert(object[] values, Type targetType, object parameter, Cultur /// The converter parameter to use. /// The culture to use in the converter. /// A converted values. If the method returns nullNothingnullptra null reference (Nothing in Visual Basic), the valid null value is used. - public object[] ConvertBack( object value, Type[] targetTypes, object parameter, CultureInfo culture) + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs index 57292688490..8c6a836d242 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs @@ -85,7 +85,6 @@ protected override Size ArrangeOverride(Size finalSize) { return base.ArrangeOverride(finalSize); } - } partial void OnChildChangedImplementation(PropertyChangedEventArgs e) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs index e10f8f8ddd7..69bca1d9029 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs @@ -61,6 +61,7 @@ public bool StartFilterOnExpressionChanged { return this.startFilterOnExpressionChanged; } + set { this.startFilterOnExpressionChanged = value; @@ -79,6 +80,7 @@ public bool HasFilterExpression { return this.hasFilterExpression; } + protected set { this.hasFilterExpression = value; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs index 3f7ebb8f699..9844968df78 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs @@ -58,7 +58,7 @@ protected FilterRule() /// /// Occurs when the values of this rule changes. /// - [field:NonSerialized] + [field: NonSerialized] public event EventHandler EvaluationResultInvalidated; /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs index d852382f7ae..3b378f3ee6b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs @@ -145,6 +145,5 @@ private bool TryGetPropertyValue(object item, out T propertyValue) } #endregion Private Methods - } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs index 83e11e1e998..f7bc14fd9cc 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs @@ -69,4 +69,3 @@ private void Initialize(StreamingContext context) } } } - diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs index 7f1339b354e..7cfafb5f428 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs @@ -34,6 +34,7 @@ public bool IgnoreCase { return this.ignoreCase; } + set { this.ignoreCase = value; @@ -51,6 +52,7 @@ public bool CultureInvariant { return this.cultureInvariant; } + set { this.cultureInvariant = value; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs index 40a0b4e248b..e75809fa955 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs @@ -41,5 +41,4 @@ protected override bool Evaluate(string data) return this.ExactMatchEvaluate(data, TextStartsWithCharactersRegexPattern, TextStartsWithWordsRegexPattern); } } - } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs index bd3dfc2fde8..96c20a5819a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs @@ -147,7 +147,7 @@ public IValueConverter DisplayNameConverter /// /// Notifies listeners that the selected value has changed. /// - [field:NonSerialized] + [field: NonSerialized] public event EventHandler> SelectedValueChanged; #endregion Events diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs index b9ff40eadc5..57df7f84a97 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs @@ -152,7 +152,6 @@ private bool IsValueEmpty() return true; } - string stringValue = this.Value.ToString(); if (string.IsNullOrEmpty(stringValue)) { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs index fa687903902..cb3e1853cc9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs @@ -200,7 +200,6 @@ public void ClearValidationRules() /// protected abstract DataErrorInfoValidationResult Validate(); - /// /// Called to validate the property with the given name. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs index 125496933fe..20cbb4641fb 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs @@ -33,13 +33,14 @@ public string ErrorMessage get; private set; } + private static readonly DataErrorInfoValidationResult valid = new DataErrorInfoValidationResult(true, null, string.Empty); /// /// Geta an instance of DataErrorInfoValidationResult that corresponds /// to a valid result. /// - public new static DataErrorInfoValidationResult ValidResult + public static new DataErrorInfoValidationResult ValidResult { get { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs index 317e9abd3fa..931d5c3195b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs @@ -149,7 +149,7 @@ private FilterExpressionNode CreateFilterExpression() { List groupNodes = new List(); - for (int i = 0; i < this.filterRulePanelItems.Count; ) + for (int i = 0; i < this.filterRulePanelItems.Count;) { int endIndex = this.GetExclusiveEndIndexForGroupStartingAt(i); @@ -254,7 +254,6 @@ private void UpdateFilterRulePanelItemTypes() { this.filterRulePanelItems[i].ItemType = FilterRulePanelItemType.Item; } - } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs index 470e2656e34..c68de49cfef 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs @@ -40,7 +40,6 @@ public object Convert(object value, Type targetType, object parameter, System.Gl return DependencyProperty.UnsetValue; } - FilterRule rule = value as FilterRule; if (rule == null) { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs index c96584fe455..5cf08b77872 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs @@ -106,6 +106,5 @@ private object GetBackgroundTextForType(Type inputType) } #endregion Helpers - } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs index 862129e6b58..5524262d4cc 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs @@ -83,6 +83,7 @@ public SearchTextParser Parser return this.parser; } + set { if (value == null) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs index de5bbf2931c..c290765beb6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs @@ -13,7 +13,6 @@ namespace Microsoft.Management.UI.Internal [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] public class ValidatingValueToGenericParameterTypeConverter : IValueConverter { - /// /// Gets an instance of the ValidatingValueToGenericParameterTypeConverter class. /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs index 3a4d2dc965d..b72ae0ed664 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs @@ -22,7 +22,6 @@ namespace Microsoft.Management.UI.Internal /// By contrast, the converter for an /// will be called even if any or all of the bindings fail to evaluate /// down to the last property. - /// /// Note that the which uses this /// must have exactly one /// . diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs index 805b16d2968..d2b8c388912 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs @@ -167,7 +167,6 @@ internal void OnColumnPicker(object sender, RoutedEventArgs e) // after it is added back. // Solution: Remove the column, change the width, // add the column back, then change the width back. - double width = column.Width; column.Width = 0d; this.Columns.Add(column); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs index 3b7208d1468..f106851d876 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs @@ -74,7 +74,6 @@ private void GetPropertyValues(string propertyName, object a, object b, out obje { // NOTE : Being unable to retrieve the value is equivalent to getting a null in // this case since they will both be treated as "having no value" for CompareTo. - firstValue = null; secondValue = null; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/UIPropertyGroupDescription.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/UIPropertyGroupDescription.cs index e21f60f0bf6..b3a5230fabb 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/UIPropertyGroupDescription.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/UIPropertyGroupDescription.cs @@ -76,6 +76,7 @@ public ListSortDirection SortDirection { return this.sortDirection; } + set { this.sortDirection = value; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs index 4e21fda73ce..eb1ac733205 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs @@ -409,7 +409,6 @@ private void Evaluator_FilterExpressionChanged(object sender, EventArgs e) // For non-live mode, stop filtering if the user has cleared the filter (rules and search text). // This allows the user to clear search results without having to click the Search button on an empty filter. // This happens automatically in live mode. - if (false == this.Evaluator.StartFilterOnExpressionChanged && false == this.FilterRulePanel.HasFilterExpression && false == this.SearchBox.HasFilterExpression) diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/AllModulesControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/AllModulesControl.xaml.cs index c6d35b3d689..72fe58b264f 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/AllModulesControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/AllModulesControl.xaml.cs @@ -21,7 +21,8 @@ public AllModulesControl() { InitializeComponent(); - this.Loaded += (obj, args) => { + this.Loaded += (obj, args) => + { this.ModulesCombo.Focus(); }; } diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs index 52a0eb7adc6..01fcd123c5e 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs @@ -651,7 +651,7 @@ private void OnNotifyPropertyChanged(string propertyName) PropertyChangedEventHandler handler = this.PropertyChanged; if (handler != null) { - handler (this, new PropertyChangedEventArgs(propertyName)); + handler(this, new PropertyChangedEventArgs(propertyName)); } } #endregion diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs index 21e1b521811..e329d974d72 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs @@ -11,13 +11,12 @@ using System.Management.Automation; using System.Text; using System.Windows; - -using SMAI = System.Management.Automation.Internal; - using Microsoft.Management.UI; using Microsoft.Management.UI.Internal; using Microsoft.PowerShell.Commands.ShowCommandExtension; +using SMAI = System.Management.Automation.Internal; + namespace Microsoft.PowerShell.Commands.ShowCommandInternal { /// diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs index 39b03353ee0..477c989db3c 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs @@ -15,7 +15,6 @@ namespace Microsoft.PowerShell.Commands.ShowCommandInternal /// public partial class ShowAllModulesWindow : Window { - /// /// private constants for ZoomLevel /// @@ -36,7 +35,6 @@ public partial class ShowAllModulesWindow : Window /// private const double ZOOM_MIN = 0.5; - #region Construction and Destructor /// @@ -92,7 +90,6 @@ public ShowAllModulesWindow() minusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Minus")); CommandBindings.Add(new CommandBinding(minusSettings, ZoomEventHandlerMinus)); } - } /// diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs index a31f5765141..b720a3e6b69 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs @@ -57,7 +57,6 @@ internal class OutGridViewWindow /// private AutoResetEvent gridViewWindowLoaded; - /// Is used to store any Management list calls exceptions. private Exception exception = null; @@ -353,7 +352,7 @@ private void OK_Click(object sender, RoutedEventArgs e) if (this.managementList.List.SelectedItems.Count != 0) { this.selectedItems = new List(); - foreach(PSObject obj in this.managementList.List.SelectedItems) + foreach (PSObject obj in this.managementList.List.SelectedItems) { this.selectedItems.Add(obj); } @@ -562,7 +561,7 @@ private void GridViewWindowClosed(object sender, EventArgs e) { this.closedEvent.Set(); } - catch(ObjectDisposedException) + catch (ObjectDisposedException) { // we tried to avoid this exception with "&& !this.closedEvent.SafeWaitHandle.IsClosed" // but since this runs in a different thread the if condition could be evaluated and after that diff --git a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 index 0b0aabff5af..e655e5d317c 100644 --- a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 +++ b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 @@ -439,7 +439,7 @@ Describe "Verify approved aliases list" -Tags "CI" { "Cmdlet", "Set-WmiInstance", "", $($FullCLR ), "", "", "" "Cmdlet", "Set-WSManInstance", "", $($FullCLR -or $CoreWindows ), "", "", "None" "Cmdlet", "Set-WSManQuickConfig", "", $($FullCLR -or $CoreWindows ), "", "", "None" -"Cmdlet", "Show-Command", "", $($FullCLR -or $CoreWindows ), "", "", "" +"Cmdlet", "Show-Command", "", $($FullCLR -or $CoreWindows ), "", "", "None" "Cmdlet", "Show-ControlPanelItem", "", $($FullCLR ), "", "", "" "Cmdlet", "Show-EventLog", "", $($FullCLR ), "", "", "" "Cmdlet", "Show-Markdown", "", $( $CoreWindows -or $CoreUnix), "", "", "None" From 8d1d13ef9bdcf44c55cd2acd894033b4f445bc19 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Fri, 25 Oct 2019 18:27:03 -0700 Subject: [PATCH 14/22] more codefactor fixes --- .../HelpWindow/ParagraphBuilder.cs | 4 +- .../ManagementList/Common/AutomationButton.cs | 2 +- .../Common/CustomTypeComparer.cs | 4 +- .../Common/DateTimeApproximationComparer.cs | 10 ++--- .../ManagementList/Common/DismissiblePopup.cs | 2 +- .../Common/IntegralConverter.cs | 2 +- .../ManagementList/Common/IsEqualConverter.cs | 2 +- .../Common/IsNotNullConverter.cs | 2 +- .../ManagementList/Common/KeyboardHelp.cs | 2 +- .../Common/ListOrganizerItem.cs | 6 +-- .../ManagementList/Common/PickerBase.cs | 6 +-- .../Common/PopupControlButton.cs | 2 +- .../ManagementList/Common/ScalableImage.cs | 4 +- .../Common/ScalableImageSource.Generated.cs | 2 +- .../ManagementList/Common/TextBlockService.cs | 2 +- .../Common/VisualToAncestorDataConverter.cs | 2 +- .../ManagementList/Common/WpfHelp.cs | 4 +- .../ManagementList/CommonControls/Resizer.cs | 8 ++-- .../DefaultFilterRuleCustomizationFactory.cs | 32 +++++++------- .../FilterCore/FilterEvaluator.cs | 4 +- .../FilterExpressionAndOperatorNode.cs | 2 +- .../FilterExpressionOperandNode.cs | 2 +- .../FilterExpressionOrOperatorNode.cs | 2 +- .../FilterRuleCustomizationFactory.cs | 2 +- .../FilterRules/EqualsFilterRule.cs | 2 +- .../FilterCore/FilterRules/FilterRule.cs | 2 +- .../FilterRules/IsEmptyFilterRule.cs | 2 +- .../FilterRules/IsGreaterThanFilterRule.cs | 2 +- .../FilterRules/IsLessThanFilterRule.cs | 2 +- .../FilterRules/IsNotEmptyValidationRule.cs | 2 +- .../PropertyValueSelectorFilterRule.cs | 2 +- .../FilterRules/SelectorFilterRule.cs | 2 +- .../FilterCore/ItemsControlFilterEvaluator.cs | 8 ++-- .../FilterCore/ValidatingSelectorValue.cs | 6 +-- .../FilterCore/ValidatingValue.cs | 2 +- .../FilterCore/ValidatingValueBase.cs | 4 +- .../FilterProviders/AddFilterRulePicker.cs | 2 +- .../AddFilterRulePickerItem.cs | 2 +- .../FilterProviders/FilterRulePanel.cs | 43 +++++++++---------- .../FilterRulePanelController.cs | 8 ++-- .../FilterProviders/FilterRulePanelItem.cs | 2 +- .../FilterRuleTemplateSelector.cs | 2 +- .../InputFieldBackgroundTextConverter.cs | 8 ++-- .../FilterProviders/SearchBox.cs | 4 +- .../ManagementList/ColumnPicker.xaml.cs | 22 ++++------ .../ManagementList/InnerListGridView.cs | 2 +- .../ManagementList/Innerlist.cs | 8 ++-- .../ManagementListStateDescriptor.cs | 2 +- .../ManagementList/PropertyValueGetter.cs | 2 +- .../ManagementList/innerlistcolumn.cs | 6 +-- .../ManagementList/managementlist.cs | 22 +++++----- .../Windows/ShowAllModulesWindow.xaml.cs | 4 +- .../engine/Basic/DefaultCommands.Tests.ps1 | 2 +- 53 files changed, 141 insertions(+), 146 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs index 8a183cf32ec..53face17b96 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs @@ -156,12 +156,12 @@ internal void HighlightAllInstancesOf(string search, bool caseSensitive, bool wh { if (wholeWord) { - if (match > 0 && Char.IsLetterOrDigit(text[match - 1])) + if (match > 0 && char.IsLetterOrDigit(text[match - 1])) { break; } - if ((match + search.Length <= text.Length - 1) && Char.IsLetterOrDigit(text[match + search.Length])) + if ((match + search.Length <= text.Length - 1) && char.IsLetterOrDigit(text[match + search.Length])) { break; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/AutomationButton.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/AutomationButton.cs index a59322aaedd..d5e40a33721 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/AutomationButton.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/AutomationButton.cs @@ -70,7 +70,7 @@ public AutomationButtonAutomationPeer(Button owner) /// This method always returns false. protected override bool IsControlElementCore() { - return (this.Owner.Visibility != Visibility.Hidden); + return this.Owner.Visibility != Visibility.Hidden; } #endregion diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs index 81db96f05a7..59120414c6f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs @@ -47,7 +47,7 @@ static CustomTypeComparer() public static int Compare(T value1, T value2) where T : IComparable { IComparer comparer; - if (false == TryGetCustomComparer(out comparer)) + if (TryGetCustomComparer(out comparer) == false) { return value1.CompareTo(value2); } @@ -60,7 +60,7 @@ private static bool TryGetCustomComparer(out IComparer comparer) where T : comparer = null; object uncastComparer = null; - if (false == comparers.TryGetValue(typeof(T), out uncastComparer)) + if (comparers.TryGetValue(typeof(T), out uncastComparer) == false) { return false; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DateTimeApproximationComparer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DateTimeApproximationComparer.cs index c572ed1b3f3..c2cc3e94f22 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DateTimeApproximationComparer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DateTimeApproximationComparer.cs @@ -57,12 +57,12 @@ private static void GetRoundedValues(DateTime value1, DateTime value2, out DateT private static bool HasTimeComponent(DateTime value) { bool hasNoTimeComponent = true - && 0 == value.Hour - && 0 == value.Minute - && 0 == value.Second - && 0 == value.Millisecond; + && value.Hour == 0 + && value.Minute == 0 + && value.Second == 0 + && value.Millisecond == 0; - return (!hasNoTimeComponent); + return !hasNoTimeComponent; } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs index 22ea875aba8..72b9d5a982b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs @@ -105,7 +105,7 @@ private FrameworkElement FindPopupRoot() { DependencyObject element = this.Child; - while (false == element.GetType().Name.Equals("PopupRoot", StringComparison.Ordinal)) + while (element.GetType().Name.Equals("PopupRoot", StringComparison.Ordinal) == false) { element = VisualTreeHelper.GetParent(element); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs index bf01859eb9e..a4cb08d9a63 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs @@ -54,7 +54,7 @@ public object Convert(object[] values, Type targetType, object parameter, System if (parameter != null) { - padding = Double.Parse((string)parameter, CultureInfo.InvariantCulture); + padding = double.Parse((string)parameter, CultureInfo.InvariantCulture); } var newSource = source - padding; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs index cadfc8e357c..d079174ed7d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs @@ -46,7 +46,7 @@ public object Convert(object[] values, Type targetType, object parameter, System if (item1 == null) { - return (item2 == null); + return item2 == null; } if (item2 == null) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs index d8891340ac7..18461f24d6b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs @@ -25,7 +25,7 @@ public class IsNotNullConverter : IValueConverter /// Returns true if value is not null, false otherwise. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - return (null != value); + return value != null; } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs index 0e943731a6f..a4633bc76f8 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs @@ -142,7 +142,7 @@ private static bool IsFlowDirectionKey(Key key) private static bool IsElementRightToLeft(DependencyObject element) { FlowDirection flowDirection = FrameworkElement.GetFlowDirection(element); - bool rightToLeft = (flowDirection == FlowDirection.RightToLeft); + bool rightToLeft = flowDirection == FlowDirection.RightToLeft; return rightToLeft; } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs index 109db188883..05b2781b44a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs @@ -35,7 +35,7 @@ public bool IsInEditMode { get { - return (null != this.renameButton) ? this.renameButton.IsChecked.Value : false; + return (this.renameButton != null) ? this.renameButton.IsChecked.Value : false; } } @@ -234,7 +234,7 @@ private void AttachToVisualTree() this.editBox.LostFocus += new RoutedEventHandler(this.EditBox_LostFocus); this.templatedParent = this.TemplatedParent as FrameworkElement; - if (null != this.templatedParent) + if (this.templatedParent != null) { this.templatedParent.KeyDown += new KeyEventHandler(this.TemplatedParent_OnKeyDown); } @@ -249,7 +249,7 @@ private void DetachFromVisualTree() this.editBox.LostFocus -= this.EditBox_LostFocus; } - if (null != this.templatedParent) + if (this.templatedParent != null) { this.templatedParent.KeyDown -= this.TemplatedParent_OnKeyDown; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.cs index 7292499513f..e09d7697f42 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.cs @@ -51,7 +51,7 @@ private void ApplyDropDownButtonTemplate() return; } - if (null != this.DropDownButtonTemplate && !ReferenceEquals(this.dropDownButton.Template, this.DropDownButtonTemplate)) + if (this.DropDownButtonTemplate != null && !ReferenceEquals(this.dropDownButton.Template, this.DropDownButtonTemplate)) { this.dropDownButton.Template = this.DropDownButtonTemplate; } @@ -79,7 +79,7 @@ private void FocusDropDown() this.dropDown.Loaded += new RoutedEventHandler(this.DropDown_Loaded_FocusDropDown); } - if (null != this.dropDown.Child && !this.dropDown.IsAncestorOf((DependencyObject)Keyboard.FocusedElement)) + if (this.dropDown.Child != null && !this.dropDown.IsAncestorOf((DependencyObject)Keyboard.FocusedElement)) { this.dropDown.Child.MoveFocus(new TraversalRequest(FocusNavigationDirection.First)); } @@ -122,7 +122,7 @@ private void AttachToVisualTree() private void DetachFromVisualTree() { - if (null != this.dropDown) + if (this.dropDown != null) { this.dropDown.Opened -= this.DropDown_Opened; this.dropDown.Closed -= this.DropDown_Closed; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs index 0656c8845da..6fd09b4c61d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs @@ -105,7 +105,7 @@ partial void OnIsPopupOpenChangedImplementation(PropertyChangedEventArgs e } } - if (false == this.isClickInProgress) + if (this.isClickInProgress == false) { this.UpdateIsChecked(); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImage.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImage.cs index 2d55fa80979..8c2a8fc4c8f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImage.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImage.cs @@ -94,13 +94,13 @@ partial void OnSourceChangedImplementation(PropertyChangedEventArgs e) /// /// Identifies the Size dependency property. /// - public static readonly DependencyProperty SizeProperty = DependencyProperty.Register( "Size", typeof(Size), typeof(ScalableImageSource), new PropertyMetadata( new Size(Double.NaN, Double.NaN), SizeProperty_PropertyChanged) ); + public static readonly DependencyProperty SizeProperty = DependencyProperty.Register( "Size", typeof(Size), typeof(ScalableImageSource), new PropertyMetadata( new Size(double.NaN, double.NaN), SizeProperty_PropertyChanged) ); /// /// Gets or sets the suggested size of the image. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs index 91ced8251af..dd2fc61ddd9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs @@ -85,7 +85,7 @@ private static bool CalculateIsTextTrimmed(TextBlock textBlock) textBlock.Foreground); #pragma warning restore 612, 618 - return (formattedText.Width > textBlock.ActualWidth); + return formattedText.Width > textBlock.ActualWidth; } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/VisualToAncestorDataConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/VisualToAncestorDataConverter.cs index 80b174ae71c..1d2776ce8e9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/VisualToAncestorDataConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/VisualToAncestorDataConverter.cs @@ -39,7 +39,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn Type dataType = (Type)parameter; - if (false == dataType.IsClass) + if (dataType.IsClass == false) { throw new ArgumentException("The specified value is not a class type.", "parameter"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs index 73f1c03194e..f50d2a51146 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs @@ -138,7 +138,7 @@ public bool IsEmpty { get { - return (0 == this.callbacks.Count); + return this.callbacks.Count == 0; } } } @@ -284,7 +284,7 @@ public static T GetVisualChild(DependencyObject obj) where T : DependencyObje var element = elementQueue.Dequeue(); T item = element as T; - if (null != item) + if (item != null) { return item; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs index d254c2af0c3..32d47ca8d57 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs @@ -51,12 +51,12 @@ internal static Thickness CreateGripThickness(double visibleGripWidth, ResizeGri { Thickness thickness; - if (visibleGripWidth < 0.0 || Double.IsNaN(visibleGripWidth)) + if (visibleGripWidth < 0.0 || double.IsNaN(visibleGripWidth)) { throw new ArgumentOutOfRangeException("visibleGripWidth", "The value must be greater than or equal to 0."); } - if (Double.IsInfinity(visibleGripWidth)) + if (double.IsInfinity(visibleGripWidth)) { throw new ArgumentOutOfRangeException("visibleGripWidth", "The value must be less than infinity."); } @@ -169,7 +169,7 @@ private void PerformDrag(ResizeGripLocation location, DragDeltaEventArgs e) private void StartDragging(ResizeGripLocation location) { - if (false == this.ResizeWhileDragging) + if (this.ResizeWhileDragging == false) { if (this.adornerLayer == null) { @@ -185,7 +185,7 @@ private void StartDragging(ResizeGripLocation location) private void StopDragging(ResizeGripLocation location, DragCompletedEventArgs e) { - if (false == this.ResizeWhileDragging) + if (this.ResizeWhileDragging == false) { this.RemoveAdorner(); double newWidth = this.GetNewWidth(location, e.HorizontalChange); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs index 72de06fd05c..7643eaab657 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs @@ -71,7 +71,7 @@ public override ICollection CreateDefaultFilterRulesForPropertyValue rules.Add(new IsEmptyFilterRule()); rules.Add(new IsNotEmptyFilterRule()); } - else if (t == typeof(Boolean)) + else if (t == typeof(bool)) { rules.Add(new EqualsFilterRule()); } @@ -168,16 +168,16 @@ public override string GetErrorMessageForInvalidValue(string value, Type typeToP } bool isNumericType = false - || typeToParseTo == typeof(Byte) - || typeToParseTo == typeof(SByte) - || typeToParseTo == typeof(Int16) - || typeToParseTo == typeof(UInt16) - || typeToParseTo == typeof(Int32) - || typeToParseTo == typeof(UInt32) - || typeToParseTo == typeof(Int64) - || typeToParseTo == typeof(UInt64) + || typeToParseTo == typeof(byte) + || typeToParseTo == typeof(sbyte) + || typeToParseTo == typeof(short) + || typeToParseTo == typeof(ushort) + || typeToParseTo == typeof(int) + || typeToParseTo == typeof(uint) + || typeToParseTo == typeof(long) + || typeToParseTo == typeof(ulong) || typeToParseTo == typeof(Single) - || typeToParseTo == typeof(Double); + || typeToParseTo == typeof(double); if (isNumericType) { @@ -201,7 +201,7 @@ private bool TryGetGenericParameterForComparableValueFilterRule(FilterRule rule, genericParameter = null; TextFilterRule textRule = rule as TextFilterRule; - if (null != textRule) + if (textRule != null) { genericParameter = typeof(string); return true; @@ -261,7 +261,7 @@ private void SetValueOnValidatingValue(FilterRule rule, string propertyName, obj private bool TryTransferValuesAsSingleValueComparableValueFilterRule(FilterRule oldRule, FilterRule newRule) { - Debug.Assert(null != oldRule && null != newRule); + Debug.Assert(oldRule != null && newRule != null); bool areCorrectType = this.IsSingleValueComparableValueFilterRule(oldRule) && this.IsSingleValueComparableValueFilterRule(newRule); @@ -278,7 +278,7 @@ private bool TryTransferValuesAsSingleValueComparableValueFilterRule(FilterRule private bool TryClearValueFromSingleValueComparableValueFilterRule(FilterRule rule) { - Debug.Assert(null != rule); + Debug.Assert(rule != null); if (!this.IsSingleValueComparableValueFilterRule(rule)) { @@ -292,7 +292,7 @@ private bool TryClearValueFromSingleValueComparableValueFilterRule(FilterRule ru private bool IsSingleValueComparableValueFilterRule(FilterRule rule) { - Debug.Assert(null != rule); + Debug.Assert(rule != null); Type genericParameter; if (!this.TryGetGenericParameterForComparableValueFilterRule(rule, out genericParameter)) @@ -313,7 +313,7 @@ private bool IsSingleValueComparableValueFilterRule(FilterRule rule) private bool TryClearIsBetweenFilterRule(FilterRule rule) { - Debug.Assert(null != rule); + Debug.Assert(rule != null); if (!this.IsIsBetweenFilterRule(rule)) { @@ -328,7 +328,7 @@ private bool TryClearIsBetweenFilterRule(FilterRule rule) private bool IsIsBetweenFilterRule(FilterRule rule) { - Debug.Assert(null != rule); + Debug.Assert(rule != null); Type genericParameter; if (!this.TryGetGenericParameterForComparableValueFilterRule(rule, out genericParameter)) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs index 69bca1d9029..952c8309192 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs @@ -185,7 +185,7 @@ protected void NotifyPropertyChanged(string propertyName) PropertyChangedEventHandler eh = this.PropertyChanged; - if (null != eh) + if (eh != null) { eh(this, new PropertyChangedEventArgs(propertyName)); } @@ -208,7 +208,7 @@ protected void NotifyPropertyChanged(string propertyName) protected virtual void NotifyFilterExpressionChanged() { EventHandler eh = this.FilterExpressionChanged; - if (null != eh) + if (eh != null) { eh(this, new EventArgs()); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs index cd9101ba366..63e76f79249 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs @@ -77,7 +77,7 @@ public FilterExpressionAndOperatorNode(IEnumerable childre /// public override bool Evaluate(object item) { - if (0 == this.Children.Count) + if (this.Children.Count == 0) { return false; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs index b939e5aa089..68a31e785df 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs @@ -62,7 +62,7 @@ public FilterExpressionOperandNode(FilterRule rule) /// public override bool Evaluate(object item) { - Debug.Assert(null != this.Rule); + Debug.Assert(this.Rule != null); return this.Rule.Evaluate(item); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs index 23e6125b7f7..d5d7646953a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs @@ -77,7 +77,7 @@ public FilterExpressionOrOperatorNode(IEnumerable children /// public override bool Evaluate(object item) { - if (0 == this.Children.Count) + if (this.Children.Count == 0) { return false; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs index fb744576459..be386d8389e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs @@ -26,7 +26,7 @@ public static FilterRuleCustomizationFactory FactoryInstance { get { - Debug.Assert(null != factoryInstance); + Debug.Assert(factoryInstance != null); return factoryInstance; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs index fbf9e2d2df7..a7d2fbfec26 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs @@ -39,7 +39,7 @@ protected override bool Evaluate(T data) Debug.Assert(this.IsValid); int result = CustomTypeComparer.Compare(this.Value.GetCastValue(), data); - return (0 == result); + return result == 0; } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs index 9844968df78..ccd6bcc3e52 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs @@ -68,7 +68,7 @@ protected void NotifyEvaluationResultInvalidated() { var eh = this.EvaluationResultInvalidated; - if (null != eh) + if (eh != null) { eh(this, new EventArgs()); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs index 6d4e9b5f956..5db9fc45d47 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs @@ -40,7 +40,7 @@ public override bool Evaluate(object item) if (typeof(string) == type) { - return 0 == ((string)item).Trim().Length; + return ((string)item).Trim().Length == 0; } return false; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs index 50ac05a6f01..270aa359398 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs @@ -39,7 +39,7 @@ protected override bool Evaluate(T data) Debug.Assert(this.IsValid); int result = CustomTypeComparer.Compare(this.Value.GetCastValue(), data); - return (result <= 0); + return result <= 0; } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs index f36253007dd..b36b38360ba 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs @@ -39,7 +39,7 @@ protected override bool Evaluate(T item) Debug.Assert(this.IsValid); int result = CustomTypeComparer.Compare(this.Value.GetCastValue(), item); - return (result >= 0); + return result >= 0; } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs index dbf3a16d70b..030e37ee2e2 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs @@ -55,7 +55,7 @@ public override DataErrorInfoValidationResult Validate(object value, System.Glob internal static bool IsStringNotEmpty(string value) { - return !(string.IsNullOrEmpty(value) || 0 == value.Trim().Length); + return !(string.IsNullOrEmpty(value) || value.Trim().Length == 0); } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs index 3b378f3ee6b..06cf9448bd5 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs @@ -139,7 +139,7 @@ private bool TryGetPropertyValue(object item, out T propertyValue) { propertyValue = default(T); - Debug.Assert(null != item); + Debug.Assert(item != null); return FilterRuleCustomizationFactory.FactoryInstance.PropertyValueGetter.TryGetPropertyValue(this.PropertyName, item, out propertyValue); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs index c07c049e1ee..c229cc421b9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs @@ -22,7 +22,7 @@ public override bool IsValid { get { - return (this.AvailableRules.IsValid && this.AvailableRules.SelectedValue.IsValid); + return this.AvailableRules.IsValid && this.AvailableRules.SelectedValue.IsValid; } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs index 24e62eb9c95..a7213cc6bd7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs @@ -31,7 +31,7 @@ public ItemsControl FilterTarget set { - if (null != this.filterTarget) + if (this.filterTarget != null) { this.StopFilter(); } @@ -73,7 +73,7 @@ public override void StartFilter() // Cache the expression for filtering so subsequent changes are ignored \\ this.CachedFilterExpression = this.FilterExpression; - if (null != this.CachedFilterExpression) + if (this.CachedFilterExpression != null) { this.FilterTarget.Items.Filter = this.FilterExpressionAdapter; this.FilterStatus = FilterStatus.Applied; @@ -109,7 +109,7 @@ public override void StopFilter() private bool FilterExpressionAdapter(object item) { - Debug.Assert(null != this.CachedFilterExpression); + Debug.Assert(this.CachedFilterExpression != null); try { @@ -129,7 +129,7 @@ private bool FilterExpressionAdapter(object item) private bool TryNotifyFilterException(Exception e) { EventHandler eh = this.FilterExceptionOccurred; - if (null != eh) + if (eh != null) { eh(this, new FilterExceptionEventArgs(e)); return true; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs index 96c20a5819a..2e89ceaa03f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs @@ -129,7 +129,7 @@ public IValueConverter DisplayNameConverter set { - if (null != value && !value.GetType().IsSerializable) + if (value != null && !value.GetType().IsSerializable) { throw new ArgumentException("The DisplayNameConverter must be serializable.", "value"); } @@ -215,7 +215,7 @@ protected void NotifySelectedValueChanged(T oldValue, T newValue) { EventHandler> eh = this.SelectedValueChanged; - if (null != eh) + if (eh != null) { eh(this, new PropertyChangedEventArgs(oldValue, newValue)); } @@ -231,7 +231,7 @@ protected void NotifySelectedValueChanged(T oldValue, T newValue) private bool IsIndexWithinBounds(int value) { - return (value >= 0 && value < this.AvailableValues.Count); + return value >= 0 && value < this.AvailableValues.Count; } #endregion IsIndexWithinBounds diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs index 57df7f84a97..28929d5cb78 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs @@ -192,7 +192,7 @@ private bool TryGetCastValue(object rawValue, out T castValue) private bool TryGetEnumValue(object rawValue, out T castValue) { - Debug.Assert(null != rawValue); + Debug.Assert(rawValue != null); Debug.Assert(typeof(T).IsEnum); castValue = default(T); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs index cb3e1853cc9..78f0088abe3 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs @@ -262,7 +262,7 @@ protected void NotifyPropertyChanged(string propertyName) { PropertyChangedEventHandler eh = this.PropertyChanged; - if (null != eh) + if (eh != null) { eh(this, new PropertyChangedEventArgs(propertyName)); } @@ -304,7 +304,7 @@ private void UpdateValidationResult(string columnName) private void NotifyValidationResultUpdated() { - Debug.Assert(null != this.cachedValidationResult); + Debug.Assert(this.cachedValidationResult != null); this.NotifyPropertyChanged("IsValid"); this.NotifyPropertyChanged("Error"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs index 084624a491e..8ea2726205c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs @@ -49,7 +49,7 @@ public ObservableCollection ColumnFilterRules partial void OnOkAddFilterRulesCanExecuteImplementation(System.Windows.Input.CanExecuteRoutedEventArgs e) { - e.CanExecute = (null != this.AddFilterRulesCommand) + e.CanExecute = (this.AddFilterRulesCommand != null) ? CommandHelper.CanExecuteCommand(this.AddFilterRulesCommand, null, this.AddFilterRulesCommandTarget) : false; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs index 75a22f521cd..91bf4868893 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs @@ -72,7 +72,7 @@ protected void NotifyPropertyChanged(string propertyName) { PropertyChangedEventHandler eh = this.PropertyChanged; - if (null != eh) + if (eh != null) { eh(this, new PropertyChangedEventArgs(propertyName)); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs index 68e6197b045..ce890486f3d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs @@ -214,7 +214,7 @@ public void ClearContentTemplates() protected virtual void NotifyFilterExpressionChanged() { EventHandler eh = this.FilterExpressionChanged; - if (null != eh) + if (eh != null) { eh(this, new EventArgs()); } @@ -235,7 +235,7 @@ private void Controller_FilterExpressionChanged(object sender, EventArgs e) partial void OnAddRulesExecutedImplementation(ExecutedRoutedEventArgs e) { - Debug.Assert(null != e); + Debug.Assert(e != null); if (e.Parameter == null) { @@ -270,7 +270,7 @@ partial void OnAddRulesExecutedImplementation(ExecutedRoutedEventArgs e) partial void OnRemoveRuleExecutedImplementation(ExecutedRoutedEventArgs e) { - Debug.Assert(null != e); + Debug.Assert(e != null); if (e.Parameter == null) { @@ -308,7 +308,7 @@ private void InitializeTemplates() new KeyValuePair(typeof(ValidatingValue<>), "ValidatingValueTemplate"), new KeyValuePair(typeof(ValidatingSelectorValue<>), "ValidatingSelectorValueTemplate"), new KeyValuePair(typeof(IsBetweenFilterRule<>), "IsBetweenRuleTemplate"), - new KeyValuePair(typeof(Object), "CatchAllTemplate") + new KeyValuePair(typeof(object), "CatchAllTemplate") #endregion Info for Default Templates }; @@ -322,23 +322,22 @@ private void InitializeTemplatesForInputTypes() { #region Info For Input Types - typeof(SByte), - typeof(Byte), - typeof(Int16), - typeof(Int32), - typeof(Int64), - typeof(UInt16), - typeof(UInt32), - typeof(UInt64), - typeof(Char), + typeof(sbyte), + typeof(byte), + typeof(short), + typeof(int), + typeof(long), + typeof(ushort), + typeof(uint), + typeof(ulong), + typeof(char), typeof(Single), - typeof(Double), - typeof(Decimal), - typeof(Boolean), - + typeof(double), + typeof(decimal), + typeof(bool), typeof(Enum), typeof(DateTime), - typeof(String) + typeof(string) #endregion Info For Input Types }; @@ -348,13 +347,13 @@ private void InitializeTemplatesForInputTypes() private void AddFilterRulePanelItemContentTemplate(Type type, string resourceName) { - Debug.Assert(null != type); + Debug.Assert(type != null); Debug.Assert(!string.IsNullOrEmpty(resourceName)); var templateInfo = new ComponentResourceKey(typeof(FilterRulePanel), resourceName); DataTemplate template = (DataTemplate)this.TryFindResource(templateInfo); - Debug.Assert(null != template); + Debug.Assert(template != null); this.AddFilterRulePanelItemContentTemplate(type, template); } @@ -365,7 +364,7 @@ private void AddFilterRulePanelItemContentTemplate(Type type, string resourceNam private void AddFilterRuleInternal(FilterRulePanelItem item) { - Debug.Assert(null != item); + Debug.Assert(item != null); FilterRulePanelItem newItem = new FilterRulePanelItem(item.Rule.DeepCopy(), item.GroupId); this.Controller.AddFilterRulePanelItem(newItem); @@ -373,7 +372,7 @@ private void AddFilterRuleInternal(FilterRulePanelItem item) private void RemoveFilterRuleInternal(FilterRulePanelItem item) { - Debug.Assert(null != item); + Debug.Assert(item != null); this.Controller.RemoveFilterRulePanelItem(item); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs index 931d5c3195b..ef10af8293a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs @@ -48,7 +48,7 @@ public bool HasFilterExpression { get { - return (this.FilterExpression != null); + return this.FilterExpression != null; } } @@ -162,7 +162,7 @@ private FilterExpressionNode CreateFilterExpression() i = endIndex; } - if (0 == groupNodes.Count) + if (groupNodes.Count == 0) { return null; } @@ -220,7 +220,7 @@ private FilterExpressionOrOperatorNode CreateFilterExpressionForGroup(int startI private int GetInsertionIndex(FilterRulePanelItem item) { - Debug.Assert(null != item); + Debug.Assert(item != null); for (int i = this.filterRulePanelItems.Count - 1; i >= 0; i--) { @@ -267,7 +267,7 @@ private void UpdateFilterRulePanelItemTypes() protected virtual void NotifyFilterExpressionChanged() { EventHandler eh = this.FilterExpressionChanged; - if (null != eh) + if (eh != null) { eh(this, new EventArgs()); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs index 206e288a847..3e07d26b3e7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs @@ -108,7 +108,7 @@ protected void NotifyPropertyChanged(string propertyName) Debug.Assert(!string.IsNullOrEmpty(propertyName)); PropertyChangedEventHandler eh = this.PropertyChanged; - if (null != eh) + if (eh != null) { eh(this, new PropertyChangedEventArgs(propertyName)); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs index 1e8e52e416a..8cfbd0a7ab1 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs @@ -67,7 +67,7 @@ public override DataTemplate SelectTemplate(object item, System.Windows.Dependen type = type.BaseType; } - while (null != type); + while (type != null); return base.SelectTemplate(item, container); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs index 5cf08b77872..d4778260607 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs @@ -71,22 +71,22 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste private bool IsOfTypeValidatingValue(object value) { - Debug.Assert(null != value); + Debug.Assert(value != null); Type type = value.GetType(); - if (false == type.IsGenericType) + if (type.IsGenericType == false) { return false; } type = type.GetGenericTypeDefinition(); - return (type == ValidatingValueGenericType); + return type == ValidatingValueGenericType; } private Type GetGenericParameter(object value, CultureInfo culture) { - Debug.Assert(null != value); + Debug.Assert(value != null); Debug.Assert(this.IsOfTypeValidatingValue(value)); return value.GetType().GetGenericArguments()[0]; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs index 5524262d4cc..64bfc9ac724 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs @@ -46,7 +46,7 @@ public bool HasFilterExpression { get { - return (false == string.IsNullOrEmpty(this.Text)); + return string.IsNullOrEmpty(this.Text) == false; } } @@ -61,7 +61,7 @@ public bool HasFilterExpression protected virtual void NotifyFilterExpressionChanged() { EventHandler eh = this.FilterExpressionChanged; - if (null != eh) + if (eh != null) { eh(this, new EventArgs()); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs index 6acf2b6c95c..408b1c9761b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs @@ -201,7 +201,7 @@ internal void MoveDownButtonClick(object sender, RoutedEventArgs e) internal void AddButtonClick(object sender, RoutedEventArgs e) { InnerListColumn column = (InnerListColumn)this.PART_NotSelectedList.SelectedItem; - Debug.Assert(null != column); + Debug.Assert(column != null); this.SelectedColumns.Add(column); this.NotSelectedColumns.Remove(column); @@ -231,7 +231,7 @@ internal void AddButtonClick(object sender, RoutedEventArgs e) internal void RemoveButtonClick(object sender, RoutedEventArgs e) { InnerListColumn column = (InnerListColumn)this.PART_SelectedList.SelectedItem; - Debug.Assert(null != column); + Debug.Assert(column != null); int selectedIndex = this.PART_SelectedList.SelectedIndex; Debug.Assert(0 <= selectedIndex); @@ -298,21 +298,17 @@ private void OnSelectionChanged() this.AddButton.IsEnabled = (notSelectedList.SelectedIndex >= 0); int selectedIndex = selectedList.SelectedIndex; - bool selectionValid = (0 <= selectedIndex); - this.MoveUpButton.IsEnabled = (0 < selectedIndex); - this.MoveDownButton.IsEnabled = selectionValid && - (this.SelectedColumns.Count > selectedIndex + 1); + bool selectionValid = 0 <= selectedIndex; + this.MoveUpButton.IsEnabled = 0 < selectedIndex; + this.MoveDownButton.IsEnabled = selectionValid && this.SelectedColumns.Count > selectedIndex + 1; - bool hasOneColumn = (this.SelectedColumns.Count < 2); + bool hasOneColumn = this.SelectedColumns.Count < 2; bool requiredColumn = selectionValid && this.SelectedColumns[selectedIndex].Required; - this.RemoveButton.IsEnabled = - (selectionValid && !requiredColumn && !hasOneColumn); + this.RemoveButton.IsEnabled = selectionValid && !requiredColumn && !hasOneColumn; - this.RequiredColumnText.Visibility = (requiredColumn - ? Visibility.Visible : Visibility.Hidden); - this.LastColumnText.Visibility = ((hasOneColumn && !requiredColumn) - ? Visibility.Visible : Visibility.Hidden); + this.RequiredColumnText.Visibility = requiredColumn ? Visibility.Visible : Visibility.Hidden; + this.LastColumnText.Visibility = (hasOneColumn && !requiredColumn) ? Visibility.Visible : Visibility.Hidden; } #endregion enable/disable buttons diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs index d2b8c388912..60229028e7a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs @@ -155,7 +155,7 @@ internal void OnColumnPicker(object sender, RoutedEventArgs e) { this.Columns.Clear(); ObservableCollection newColumns = columnPicker.SelectedColumns; - Debug.Assert(null != newColumns, "SelectedColumns not found"); + Debug.Assert(newColumns != null, "SelectedColumns not found"); foreach (InnerListColumn column in newColumns) { Debug.Assert(column.Visible); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs index c48a3e21e72..6bac4095dc9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs @@ -245,7 +245,7 @@ private List GetDescriptionsForSorting() foreach (InnerListColumn column in this.InnerGrid.Columns) { - if (!Object.ReferenceEquals(this.SortedColumn, column)) + if (!object.ReferenceEquals(this.SortedColumn, column)) { dataDescriptions.Add(column.DataDescription); } @@ -295,10 +295,10 @@ protected override void OnItemsSourceChanged(System.Collections.IEnumerable oldV { base.OnItemsSourceChanged(oldValue, newValue); - this.itemsSourceIsEmpty = null != this.ItemsSource && this.ItemsSource.GetEnumerator().MoveNext() == false; + this.itemsSourceIsEmpty = this.ItemsSource != null && this.ItemsSource.GetEnumerator().MoveNext() == false; // A view can be created if there is data to auto-generate columns, or columns are added programatically \\ - bool canCreateView = (null != this.ItemsSource) && + bool canCreateView = (this.ItemsSource != null) && (this.itemsSourceIsEmpty == false || this.AutoGenerateColumns == false); if (canCreateView) @@ -665,7 +665,7 @@ private void HeaderActionProcess(object sender) } // If the sorted column is sorted again, reverse the sort \\ - if (Object.ReferenceEquals(column, this.sortedColumn)) + if (object.ReferenceEquals(column, this.sortedColumn)) { dataDescription.ReverseSortDirection(); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs index 8c21dc586f5..ba7d34aa16b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs @@ -457,7 +457,7 @@ private static double GetColumnWidth(InnerListColumn ilc) private static void SetColumnWidth(GridViewColumn ilc, double width) { - if (!Double.IsNaN(width)) + if (!double.IsNaN(width)) { ilc.Width = width; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs index 5a8c829e94a..6f809560f28 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueGetter.cs @@ -96,7 +96,7 @@ private PropertyDescriptor GetPropertyDescriptor(string propertyName, object val PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(value); descriptor = properties[propertyName]; - if (null != descriptor) + if (descriptor != null) { this.cachedProperties.Rows.Add(dataType, propertyName, descriptor); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/innerlistcolumn.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/innerlistcolumn.cs index 0fe0f3ed7f4..502a95b2ad2 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/innerlistcolumn.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/innerlistcolumn.cs @@ -118,9 +118,9 @@ partial void OnMinWidthChangedImplementation(PropertyChangedEventArgs e) static partial void MinWidthProperty_ValidatePropertyImplementation(double value, ref bool isValid) { - isValid = ((value >= 0.0) - && !Double.IsNaN(value) - && !Double.IsPositiveInfinity(value)); + isValid = (value >= 0.0) + && !double.IsNaN(value) + && !double.IsPositiveInfinity(value); } /// diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs index eb1ac733205..3feaa8bfa21 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs @@ -151,8 +151,8 @@ private void Evaluator_PropertyChanged(object sender, PropertyChangedEventArgs e } // If the filter has been applied or cleared, update the scroll position \\ - bool filteredItemsHaveChanged = (e.PropertyName == "FilterStatus" && - (this.Evaluator.FilterStatus == FilterStatus.Applied || this.Evaluator.FilterStatus == FilterStatus.NotApplied)); + bool filteredItemsHaveChanged = e.PropertyName == "FilterStatus" && + (this.Evaluator.FilterStatus == FilterStatus.Applied || this.Evaluator.FilterStatus == FilterStatus.NotApplied); if (filteredItemsHaveChanged && this.List.Items.Count > 0) { @@ -258,8 +258,8 @@ public void ResetView() partial void OnStartFilterCanExecuteImplementation(CanExecuteRoutedEventArgs e) { // Allow filtering if there is a filter expression or filtering has been triggered \\ - e.CanExecute = (this.Evaluator.HasFilterExpression || - this.Evaluator.FilterStatus != FilterStatus.NotApplied); + e.CanExecute = this.Evaluator.HasFilterExpression || + this.Evaluator.FilterStatus != FilterStatus.NotApplied; } partial void OnStartFilterExecutedImplementation(ExecutedRoutedEventArgs e) @@ -273,7 +273,7 @@ partial void OnStartFilterExecutedImplementation(ExecutedRoutedEventArgs e) partial void OnStopFilterCanExecuteImplementation(CanExecuteRoutedEventArgs e) { - e.CanExecute = (this.Evaluator.FilterStatus == FilterStatus.InProgress); + e.CanExecute = this.Evaluator.FilterStatus == FilterStatus.InProgress; } partial void OnStopFilterExecutedImplementation(ExecutedRoutedEventArgs e) @@ -287,7 +287,7 @@ partial void OnStopFilterExecutedImplementation(ExecutedRoutedEventArgs e) partial void OnClearFilterCanExecuteImplementation(CanExecuteRoutedEventArgs e) { - e.CanExecute = (this.FilterRulePanel.FilterRulePanelItems.Count > 0); + e.CanExecute = this.FilterRulePanel.FilterRulePanelItems.Count > 0; } partial void OnClearFilterExecutedImplementation(ExecutedRoutedEventArgs e) @@ -311,7 +311,7 @@ partial void OnClearFilterExecutedImplementation(ExecutedRoutedEventArgs e) partial void OnSaveViewCanExecuteImplementation(CanExecuteRoutedEventArgs e) { string viewName = (string)e.Parameter; - bool isNotEmpty = !string.IsNullOrEmpty(viewName) && (0 != viewName.Trim().Length); + bool isNotEmpty = !string.IsNullOrEmpty(viewName) && (viewName.Trim().Length != 0); e.CanExecute = isNotEmpty; } @@ -375,7 +375,7 @@ private void ViewManager_ItemDeleted(object sender, DataRoutedEventArgs this.RaiseEvent(new RoutedEventArgs(ViewsChangedEvent)); - if (Object.ReferenceEquals(sd, this.CurrentView)) + if (object.ReferenceEquals(sd, this.CurrentView)) { this.CurrentView = null; } @@ -409,9 +409,9 @@ private void Evaluator_FilterExpressionChanged(object sender, EventArgs e) // For non-live mode, stop filtering if the user has cleared the filter (rules and search text). // This allows the user to clear search results without having to click the Search button on an empty filter. // This happens automatically in live mode. - if (false == this.Evaluator.StartFilterOnExpressionChanged && - false == this.FilterRulePanel.HasFilterExpression && - false == this.SearchBox.HasFilterExpression) + if (this.Evaluator.StartFilterOnExpressionChanged == false && + this.FilterRulePanel.HasFilterExpression == false && + this.SearchBox.HasFilterExpression == false) { this.Evaluator.StopFilter(); } diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs index 477c989db3c..b2f9010f364 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs @@ -165,7 +165,7 @@ private void ZoomEventHandlerPlus(object sender, ExecutedRoutedEventArgs e) if (this.zoomLevel < ZOOM_MAX) { // ViewModel applies ZoomLevel after dividing it by 100, So multiply it by 100 and then later reset to normal by dividing for next zoom - this.zoomLevel = ((this.zoomLevel + ZOOM_INCREMENT) * 100); + this.zoomLevel = (this.zoomLevel + ZOOM_INCREMENT) * 100; viewModel.ZoomLevel = this.zoomLevel; this.zoomLevel /= 100; } @@ -187,7 +187,7 @@ private void ZoomEventHandlerMinus(object sender, ExecutedRoutedEventArgs e) if (this.zoomLevel >= ZOOM_MIN) { // ViewModel applies ZoomLevel after dividing it by 100, So multiply it by 100 and then later reset to normal by dividing it for next zoom - this.zoomLevel = ((this.zoomLevel - ZOOM_INCREMENT) * 100); + this.zoomLevel = (this.zoomLevel - ZOOM_INCREMENT) * 100; viewModel.ZoomLevel = this.zoomLevel; this.zoomLevel /= 100; } diff --git a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 index e655e5d317c..a5921d32240 100644 --- a/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 +++ b/test/powershell/engine/Basic/DefaultCommands.Tests.ps1 @@ -368,7 +368,7 @@ Describe "Verify approved aliases list" -Tags "CI" { "Cmdlet", "New-WSManSessionOption", "", $($FullCLR -or $CoreWindows ), "", "", "None" "Cmdlet", "Out-Default", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" "Cmdlet", "Out-File", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" -"Cmdlet", "Out-GridView", "", $($FullCLR -or $CoreWindows ), "", "", "" +"Cmdlet", "Out-GridView", "", $($FullCLR -or $CoreWindows ), "", "", "None" "Cmdlet", "Out-Host", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" "Cmdlet", "Out-LineOutput", "", $($FullCLR ), "", "", "" "Cmdlet", "Out-Null", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None" From c9a149b95985f64dca2e166f72995a3f71a09e17 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Sat, 26 Oct 2019 08:17:31 -0700 Subject: [PATCH 15/22] files.wxs update, more codefactor fixes --- assets/files.wxs | 12 ++++++++++++ .../ManagementList/Common/IntegralConverter.cs | 2 +- .../ManagementList/Common/IsEqualConverter.cs | 2 +- .../ManagementList/Common/PopupControlButton.cs | 2 +- .../ManagementList/Common/TextBlockService.cs | 4 ++-- .../ManagementList/Common/Utilities.cs | 2 +- .../ManagementList/Common/WeakEventListener.cs | 4 ++-- .../ExpanderButtonAutomationPeer.cs | 2 +- .../CommonControls/UIElementAdorner.cs | 4 ++-- .../ManagementList/FilterCore/FilterEvaluator.cs | 2 +- .../FilterProviders/FilterRulePanel.cs | 8 -------- .../ManagementList/ColumnPicker.xaml.cs | 16 ++++++++-------- .../ManagementList/DefaultStringConverter.cs | 2 +- .../ManagementList/InnerListGridView.cs | 2 +- .../ManagementList/ManagementList/Innerlist.cs | 1 - .../ManagementList/PropertyValueComparer.cs | 2 +- .../ManagementList/managementlist.cs | 2 +- .../Controls/ParameterSetControl.xaml.cs | 2 +- .../Windows/ShowAllModulesWindow.xaml.cs | 2 +- .../commandHelpers/OutGridView.cs | 2 +- 20 files changed, 39 insertions(+), 36 deletions(-) diff --git a/assets/files.wxs b/assets/files.wxs index c887be8dd61..5869628e0cd 100644 --- a/assets/files.wxs +++ b/assets/files.wxs @@ -3065,6 +3065,15 @@ + + + + + + + + + @@ -3907,6 +3916,9 @@ + + + diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs index a4cb08d9a63..515f8459b45 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs @@ -36,7 +36,7 @@ public object Convert(object[] values, Type targetType, object parameter, System throw new ArgumentNullException("values"); } - if (2 != values.Length) + if (values.Length != 2) { throw new ArgumentException("Two values expected", "values"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs index d079174ed7d..5a8542c6dae 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs @@ -36,7 +36,7 @@ public object Convert(object[] values, Type targetType, object parameter, System throw new ArgumentNullException("values"); } - if (2 != values.Length) + if (values.Length != 2) { throw new ArgumentException("Two values expected", "values"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs index 6fd09b4c61d..0a7da15ede7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs @@ -17,7 +17,7 @@ namespace Microsoft.Management.UI.Internal [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.MSInternal", "CA903:InternalNamespaceShouldNotContainPublicTypes")] public partial class PopupControlButton : ExpanderButton { - bool isClickInProgress = false; + private bool isClickInProgress = false; /// /// Tooltip to show to expand. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs index dd2fc61ddd9..f0e64c261be 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs @@ -41,13 +41,13 @@ private static void OnTextBlockSizeChanged(object sender, SizeChangedEventArgs e UpdateIsTextTrimmed(textBlock); } - static void OnTextBlockPropertyChanged(object sender, EventArgs e) + private static void OnTextBlockPropertyChanged(object sender, EventArgs e) { var textBlock = (TextBlock)sender; UpdateIsTextTrimmed(textBlock); } - static void UpdateIsTextTrimmed(TextBlock textBlock) + private static void UpdateIsTextTrimmed(TextBlock textBlock) { Debug.Assert(textBlock != null); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/Utilities.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/Utilities.cs index 6533d16dcc8..f9e4966b872 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/Utilities.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/Utilities.cs @@ -171,7 +171,7 @@ public static void ResortObservableCollection( { T sortedObject = (T)obj; int foundIndex = modify.IndexOf(sortedObject); - if (0 <= foundIndex) + if (foundIndex >= 0) { modify.Move(foundIndex, orderedPosition); orderedPosition++; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs index f8924d3e9cd..665418d6841 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs @@ -10,9 +10,9 @@ namespace Microsoft.Management.UI.Internal /// A common weak event listener which can be used for different kinds of events. /// /// The EventArgs type for the event. - class WeakEventListener : IWeakEventListener where TEventArgs : EventArgs + internal class WeakEventListener : IWeakEventListener where TEventArgs : EventArgs { - EventHandler realHander; + private EventHandler realHander; /// /// Constructs an instance of WeakEventListener. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ExpanderButtonAutomationPeer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ExpanderButtonAutomationPeer.cs index 48fdcd44265..db7ef0ed4ab 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ExpanderButtonAutomationPeer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ExpanderButtonAutomationPeer.cs @@ -72,7 +72,7 @@ ExpandCollapseState IExpandCollapseProvider.ExpandCollapseState { get { - if (true == this.expanderButton.IsChecked) + if (this.expanderButton.IsChecked == true) { return ExpandCollapseState.Expanded; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs index 8c6a836d242..57b8c934bf0 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs @@ -14,9 +14,9 @@ namespace Microsoft.Management.UI.Internal /// /// Partial class implementation for UIElementAdorner. /// - partial class UIElementAdorner : Adorner + internal partial class UIElementAdorner : Adorner { - VisualCollection children; + private VisualCollection children; /// /// Constructs an instance of UIElementAdorner. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs index 952c8309192..ab5b6a1f59a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs @@ -18,7 +18,7 @@ public abstract class FilterEvaluator : IFilterExpressionProvider, INotifyProper { #region Properties - Collection filterExpressionProviders = new Collection(); + private Collection filterExpressionProviders = new Collection(); /// /// Gets a readonly collection of the registered FilterExpressionProviders. diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs index ce890486f3d..eb60dfb8476 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs @@ -298,8 +298,6 @@ private void InitializeTemplates() List> defaultTemplates = new List>() { - #region Info for Default Templates - new KeyValuePair(typeof(SelectorFilterRule), "CompositeRuleTemplate"), new KeyValuePair(typeof(SingleValueComparableValueFilterRule<>), "ComparableValueRuleTemplate"), new KeyValuePair(typeof(IsEmptyFilterRule), "NoInputTemplate"), @@ -309,8 +307,6 @@ private void InitializeTemplates() new KeyValuePair(typeof(ValidatingSelectorValue<>), "ValidatingSelectorValueTemplate"), new KeyValuePair(typeof(IsBetweenFilterRule<>), "IsBetweenRuleTemplate"), new KeyValuePair(typeof(object), "CatchAllTemplate") - - #endregion Info for Default Templates }; defaultTemplates.ForEach(templateInfo => this.AddFilterRulePanelItemContentTemplate(templateInfo.Key, templateInfo.Value)); @@ -320,8 +316,6 @@ private void InitializeTemplatesForInputTypes() { List inputTypes = new List() { - #region Info For Input Types - typeof(sbyte), typeof(byte), typeof(short), @@ -338,8 +332,6 @@ private void InitializeTemplatesForInputTypes() typeof(Enum), typeof(DateTime), typeof(string) - - #endregion Info For Input Types }; inputTypes.ForEach(type => this.AddFilterRulePanelItemContentTemplate(type, "InputValueTemplate")); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs index 408b1c9761b..d0341e5d6ce 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs @@ -92,12 +92,12 @@ internal ColumnPicker( } } - if (0 < this.SelectedColumns.Count) + if (this.SelectedColumns.Count > 0) { this.PART_SelectedList.SelectedIndex = 0; } - if (0 < this.NotSelectedColumns.Count) + if (this.NotSelectedColumns.Count > 0) { this.PART_NotSelectedList.SelectedIndex = 0; } @@ -167,7 +167,7 @@ internal void OkButtonClick(object sender, RoutedEventArgs e) internal void MoveUpButtonClick(object sender, RoutedEventArgs e) { int selectedIndex = this.PART_SelectedList.SelectedIndex; - Debug.Assert(0 < selectedIndex, "Cannot move past top"); + Debug.Assert(selectedIndex > 0, "Cannot move past top"); this.SelectedColumns.Move(selectedIndex, selectedIndex - 1); // Moving the selected item in the bound collection does not @@ -233,7 +233,7 @@ internal void RemoveButtonClick(object sender, RoutedEventArgs e) InnerListColumn column = (InnerListColumn)this.PART_SelectedList.SelectedItem; Debug.Assert(column != null); int selectedIndex = this.PART_SelectedList.SelectedIndex; - Debug.Assert(0 <= selectedIndex); + Debug.Assert(selectedIndex >= 0); this.NotSelectedColumns.Add(column); this.SelectedColumns.Remove(column); @@ -245,7 +245,7 @@ internal void RemoveButtonClick(object sender, RoutedEventArgs e) // in the View rather than the ViewModel. this.PART_SelectedList.SelectedIndex = selectedIndex; } - else if (0 < selectedIndex) + else if (selectedIndex > 0) { // Highest-index item removed, select previous item Debug.Assert((selectedIndex - 1) < this.SelectedColumns.Count); this.PART_SelectedList.SelectedIndex = selectedIndex - 1; @@ -295,11 +295,11 @@ private void OnSelectionChanged() Selector notSelectedList = (Selector)this.FindName( "PART_NotSelectedList"); - this.AddButton.IsEnabled = (notSelectedList.SelectedIndex >= 0); + this.AddButton.IsEnabled = notSelectedList.SelectedIndex >= 0; int selectedIndex = selectedList.SelectedIndex; - bool selectionValid = 0 <= selectedIndex; - this.MoveUpButton.IsEnabled = 0 < selectedIndex; + bool selectionValid = selectedIndex >= 0; + this.MoveUpButton.IsEnabled = selectedIndex > 0; this.MoveDownButton.IsEnabled = selectionValid && this.SelectedColumns.Count > selectedIndex + 1; bool hasOneColumn = this.SelectedColumns.Count < 2; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs index b72ae0ed664..e0ac198d500 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/DefaultStringConverter.cs @@ -62,7 +62,7 @@ public string DefaultValue /// public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { - if (values == null || 1 != values.Length) + if (values == null || values.Length != 1) { throw new ArgumentNullException("values"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs index 60229028e7a..75d046f7ef1 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs @@ -145,7 +145,7 @@ internal void OnColumnPicker(object sender, RoutedEventArgs e) columnPicker.Owner = Window.GetWindow((DependencyObject)sender); bool? retval = columnPicker.ShowDialog(); - if (true != retval) + if (retval != true) { return; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs index 6bac4095dc9..7c8699ce066 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/Innerlist.cs @@ -167,7 +167,6 @@ public void ScrollIntoViewFromTop(object item) if (this.Items.Count > 0) { this.ScrollIntoView(this.Items[0]); - this.ScrollIntoView(item); } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs index f106851d876..f977ef72887 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/PropertyValueComparer.cs @@ -133,7 +133,7 @@ private int CompareData(object firstValue, object secondValue, StringComparison } else { - return string.Compare(firstValue.ToString(), secondValue.ToString(), stringComparison);; + return string.Compare(firstValue.ToString(), secondValue.ToString(), stringComparison); } } } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs index 3feaa8bfa21..3d223b67b2e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs @@ -19,7 +19,7 @@ public partial class ManagementList : Control private ReadOnlyCollection logicalChildren; - PropertiesTextContainsFilterRule defaultFullTextSearchRule = new PropertiesTextContainsFilterRule(); + private PropertiesTextContainsFilterRule defaultFullTextSearchRule = new PropertiesTextContainsFilterRule(); private ObservableCollection> views = new ObservableCollection>(); diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs index 4fadcfbfd9f..1e041c05c3d 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs @@ -24,7 +24,7 @@ public partial class ParameterSetControl : UserControl /// /// First focusable element in the generated UI. /// - UIElement firstFocusableElement; + private UIElement firstFocusableElement; /// /// Field used for the CurrentParameterSetViewModel parameter. diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs index b2f9010f364..1866becc264 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs @@ -71,7 +71,7 @@ public ShowAllModulesWindow() plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Add")); plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Plus")); CommandBindings.Add(new CommandBinding(plusSettings, ZoomEventHandlerPlus)); - }; + } RoutedCommand minusSettings = new RoutedCommand(); try diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs index b720a3e6b69..58db8d4f6e2 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs @@ -157,7 +157,7 @@ private void StartWindow(string invocation, string outputModeOptions, AutoResetE plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Add")); plusSettings.InputGestures.Add((KeyGesture)keyGestureConverter.ConvertFromString("Ctrl+Plus")); this.gridViewWindow.CommandBindings.Add(new CommandBinding(plusSettings, ZoomEventHandlerPlus)); - }; + } RoutedCommand minusSettings = new RoutedCommand(); try From 425d3f906108fcce2dff75a92e705c8bd0ea0221 Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Sat, 26 Oct 2019 08:53:14 -0700 Subject: [PATCH 16/22] fix win-arm build --- src/powershell-win-core/powershell-win-core.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/powershell-win-core/powershell-win-core.csproj b/src/powershell-win-core/powershell-win-core.csproj index d350048f8be..8da925b560c 100644 --- a/src/powershell-win-core/powershell-win-core.csproj +++ b/src/powershell-win-core/powershell-win-core.csproj @@ -50,7 +50,7 @@ - + From 43de95c63863e64706fae0663392c83c1fe99b6a Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Sat, 26 Oct 2019 09:24:34 -0700 Subject: [PATCH 17/22] codefactor fixes --- .../ManagementList/Common/CustomTypeComparer.cs | 2 +- .../ManagementList/Common/DismissiblePopup.cs | 2 +- .../ManagementList/Common/KeyboardHelp.cs | 4 ++-- .../ManagementList/Common/TextBlockService.cs | 2 +- .../ManagementList/Common/WeakEventListener.cs | 2 +- .../ManagementList/CommonControls/Resizer.cs | 2 +- .../DefaultFilterRuleCustomizationFactory.cs | 15 ++++++++------- .../ManagementList/FilterCore/FilterEvaluator.cs | 2 +- .../FilterExpressionOperandNode.cs | 2 +- .../FilterCore/FilterRuleCustomizationFactory.cs | 2 +- .../FilterCore/FilterRules/EqualsFilterRule.cs | 2 +- .../FilterRules/FilterRuleExtensions.cs | 2 +- .../FilterCore/FilterRules/IsBetweenFilterRule.cs | 2 +- .../FilterRules/IsGreaterThanFilterRule.cs | 2 +- .../FilterRules/IsLessThanFilterRule.cs | 2 +- .../PropertyValueSelectorFilterRule.cs | 2 +- .../FilterRules/TextContainsFilterRule.cs | 2 +- .../FilterRules/TextEndsWithFilterRule.cs | 2 +- .../FilterRules/TextEqualsFilterRule.cs | 2 +- .../FilterCore/FilterRules/TextFilterRule.cs | 4 ++-- .../FilterRules/TextStartsWithFilterRule.cs | 2 +- .../FilterCore/ItemsControlFilterEvaluator.cs | 2 +- .../ManagementList/FilterCore/ValidatingValue.cs | 4 ++-- .../FilterCore/ValidatingValueBase.cs | 2 +- .../FilterProviders/FilterRulePanel.cs | 14 +++++++------- .../FilterProviders/FilterRulePanelController.cs | 12 ++++++------ .../FilterProviders/FilterRulePanelItem.cs | 2 +- .../InputFieldBackgroundTextConverter.cs | 6 +++--- .../ManagementList/ColumnPicker.xaml.cs | 8 ++++---- .../ManagementList/InnerListGridView.cs | 2 +- .../ManagementListStateDescriptor.cs | 5 +++-- .../commandHelpers/OutGridView.cs | 3 +++ 32 files changed, 62 insertions(+), 57 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs index 59120414c6f..e52b52eaa5d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs @@ -65,7 +65,7 @@ private static bool TryGetCustomComparer(out IComparer comparer) where T : return false; } - Debug.Assert(uncastComparer is IComparer); + Debug.Assert(uncastComparer is IComparer, "must be IComparer"); comparer = (IComparer)uncastComparer; return true; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs index 72b9d5a982b..7323bb6d05e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs @@ -110,7 +110,7 @@ private FrameworkElement FindPopupRoot() element = VisualTreeHelper.GetParent(element); } - Debug.Assert(element != null); + Debug.Assert(element != null, "element not null"); return (FrameworkElement)element; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs index a4633bc76f8..46c15439268 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs @@ -27,7 +27,7 @@ internal static class KeyboardHelp /// The logical direction. public static LogicalDirection GetLogicalDirection(DependencyObject element, Key key) { - Debug.Assert(element != null); + Debug.Assert(element != null, "element not null"); bool rightToLeft = IsElementRightToLeft(element); @@ -66,7 +66,7 @@ public static LogicalDirection GetLogicalDirection(DependencyObject element, Key /// The focus direction. public static FocusNavigationDirection GetNavigationDirection(DependencyObject element, Key key) { - Debug.Assert(element != null); + Debug.Assert(element != null, "element not null"); Debug.Assert(IsFlowDirectionKey(key)); bool rightToLeft = IsElementRightToLeft(element); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs index f0e64c261be..ed48a9db9b7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs @@ -49,7 +49,7 @@ private static void OnTextBlockPropertyChanged(object sender, EventArgs e) private static void UpdateIsTextTrimmed(TextBlock textBlock) { - Debug.Assert(textBlock != null); + Debug.Assert(textBlock != null, "textblock not null"); if (textBlock.TextWrapping != TextWrapping.NoWrap || textBlock.TextTrimming == TextTrimming.None) { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs index 665418d6841..6bb02eda9d7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs @@ -37,7 +37,7 @@ public WeakEventListener(EventHandler handler) /// /// true if the listener handled the event. It is considered an error by the WeakEventManager handling in WPF to register a listener for an event that the listener does not handle. Regardless, the method should return false if it receives an event that it does not recognize or handle. /// - public bool ReceiveWeakEvent(Type managerType, Object sender, EventArgs e) + public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e) { TEventArgs realArgs = (TEventArgs)e; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs index 32d47ca8d57..d2bfdf8f6f7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs @@ -212,7 +212,7 @@ private double GetHorizontalDelta(ResizeGripLocation location, double horzDelta) } else { - Debug.Assert(location == ResizeGripLocation.Left); + Debug.Assert(location == ResizeGripLocation.Left, "location is left"); realDelta = -horzDelta; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs index 7643eaab657..cd0915db76d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs @@ -33,6 +33,7 @@ public override IPropertyValueGetter PropertyValueGetter return this.propertyValueGetter; } + set { if (value == null) @@ -219,7 +220,7 @@ private bool TryGetGenericParameterForComparableValueFilterRule(FilterRule rule, private object GetValueFromValidatingValue(FilterRule rule, string propertyName) { - Debug.Assert(rule != null && !string.IsNullOrEmpty(propertyName)); + Debug.Assert(rule != null && !string.IsNullOrEmpty(propertyName), "rule and propertyname are not null"); // NOTE: This isn't needed but OACR is complaining if (rule == null) @@ -238,7 +239,7 @@ private object GetValueFromValidatingValue(FilterRule rule, string propertyName) private void SetValueOnValidatingValue(FilterRule rule, string propertyName, object value) { - Debug.Assert(rule != null && !string.IsNullOrEmpty(propertyName)); + Debug.Assert(rule != null && !string.IsNullOrEmpty(propertyName), "rule and propertyname are not null"); // NOTE: This isn't needed but OACR is complaining if (rule == null) @@ -261,7 +262,7 @@ private void SetValueOnValidatingValue(FilterRule rule, string propertyName, obj private bool TryTransferValuesAsSingleValueComparableValueFilterRule(FilterRule oldRule, FilterRule newRule) { - Debug.Assert(oldRule != null && newRule != null); + Debug.Assert(oldRule != null && newRule != null, "oldrule and newrule are not null"); bool areCorrectType = this.IsSingleValueComparableValueFilterRule(oldRule) && this.IsSingleValueComparableValueFilterRule(newRule); @@ -278,7 +279,7 @@ private bool TryTransferValuesAsSingleValueComparableValueFilterRule(FilterRule private bool TryClearValueFromSingleValueComparableValueFilterRule(FilterRule rule) { - Debug.Assert(rule != null); + Debug.Assert(rule != null, "rule is not null"); if (!this.IsSingleValueComparableValueFilterRule(rule)) { @@ -292,7 +293,7 @@ private bool TryClearValueFromSingleValueComparableValueFilterRule(FilterRule ru private bool IsSingleValueComparableValueFilterRule(FilterRule rule) { - Debug.Assert(rule != null); + Debug.Assert(rule != null, "rule is not null"); Type genericParameter; if (!this.TryGetGenericParameterForComparableValueFilterRule(rule, out genericParameter)) @@ -313,7 +314,7 @@ private bool IsSingleValueComparableValueFilterRule(FilterRule rule) private bool TryClearIsBetweenFilterRule(FilterRule rule) { - Debug.Assert(rule != null); + Debug.Assert(rule != null, "rule is not null"); if (!this.IsIsBetweenFilterRule(rule)) { @@ -328,7 +329,7 @@ private bool TryClearIsBetweenFilterRule(FilterRule rule) private bool IsIsBetweenFilterRule(FilterRule rule) { - Debug.Assert(rule != null); + Debug.Assert(rule != null, "rule is not null"); Type genericParameter; if (!this.TryGetGenericParameterForComparableValueFilterRule(rule, out genericParameter)) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs index ab5b6a1f59a..d3d0c37ff09 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs @@ -181,7 +181,7 @@ public void RemoveFilterExpressionProvider(IFilterExpressionProvider provider) /// protected void NotifyPropertyChanged(string propertyName) { - Debug.Assert(!string.IsNullOrEmpty(propertyName)); + Debug.Assert(!string.IsNullOrEmpty(propertyName), "propertyName is not null"); PropertyChangedEventHandler eh = this.PropertyChanged; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs index 68a31e785df..d11a3a229aa 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs @@ -62,7 +62,7 @@ public FilterExpressionOperandNode(FilterRule rule) /// public override bool Evaluate(object item) { - Debug.Assert(this.Rule != null); + Debug.Assert(this.Rule != null, "rule is not null"); return this.Rule.Evaluate(item); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs index be386d8389e..116da6bb28d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs @@ -26,7 +26,7 @@ public static FilterRuleCustomizationFactory FactoryInstance { get { - Debug.Assert(factoryInstance != null); + Debug.Assert(factoryInstance != null, "factoryInstance not null"); return factoryInstance; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs index a7d2fbfec26..8f82fb8fa24 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs @@ -36,7 +36,7 @@ public EqualsFilterRule() /// protected override bool Evaluate(T data) { - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "isValid"); int result = CustomTypeComparer.Compare(this.Value.GetCastValue(), data); return result == 0; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs index 794f9e4ec9b..c62535b3b49 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs @@ -32,7 +32,7 @@ public static FilterRule DeepCopy(this FilterRule rule) throw new ArgumentNullException("rule"); } - Debug.Assert(rule.GetType().IsSerializable); + Debug.Assert(rule.GetType().IsSerializable, "rule is serializable"); BinaryFormatter formatter = new BinaryFormatter(null, new StreamingContext(StreamingContextStates.Clone)); MemoryStream ms = new MemoryStream(); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs index 4f579e85271..3bd47740491 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs @@ -86,7 +86,7 @@ public IsBetweenFilterRule() /// protected override bool Evaluate(T data) { - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "is valid"); int startValueComparedToData = CustomTypeComparer.Compare(this.StartValue.GetCastValue(), data); int endValueComparedToData = CustomTypeComparer.Compare(this.EndValue.GetCastValue(), data); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs index 270aa359398..3492e81bdb5 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs @@ -36,7 +36,7 @@ public IsGreaterThanFilterRule() /// protected override bool Evaluate(T data) { - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "is valid"); int result = CustomTypeComparer.Compare(this.Value.GetCastValue(), data); return result <= 0; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs index b36b38360ba..621904b104b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs @@ -36,7 +36,7 @@ public IsLessThanFilterRule() /// protected override bool Evaluate(T item) { - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "is valid"); int result = CustomTypeComparer.Compare(this.Value.GetCastValue(), item); return result >= 0; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs index 06cf9448bd5..4526d239337 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs @@ -139,7 +139,7 @@ private bool TryGetPropertyValue(object item, out T propertyValue) { propertyValue = default(T); - Debug.Assert(item != null); + Debug.Assert(item != null, "item not null"); return FilterRuleCustomizationFactory.FactoryInstance.PropertyValueGetter.TryGetPropertyValue(this.PropertyName, item, out propertyValue); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs index e19f725c6d5..86d4a160e1c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs @@ -36,7 +36,7 @@ public TextContainsFilterRule() /// protected override bool Evaluate(string data) { - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "is valid"); // True "text contains": \\ return this.ExactMatchEvaluate(data, TextContainsCharactersRegexPattern, TextContainsWordsRegexPattern); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs index 33b39d32883..55fb7c5abc5 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs @@ -36,7 +36,7 @@ public TextEndsWithFilterRule() /// protected override bool Evaluate(string data) { - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "is valid"); return this.ExactMatchEvaluate(data, TextEndsWithCharactersRegexPattern, TextEndsWithWordsRegexPattern); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs index c75838a7fa7..d95546d173d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs @@ -35,7 +35,7 @@ public TextEqualsFilterRule() /// protected override bool Evaluate(string data) { - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "is valid"); return this.ExactMatchEvaluate(data, TextEqualsCharactersRegexPattern, TextEqualsCharactersRegexPattern); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs index 7cfafb5f428..2c0cd9b618c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs @@ -111,7 +111,7 @@ protected internal string GetRegexPattern(string pattern, string exactMatchPatte throw new ArgumentNullException("exactMatchPattern"); } - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "is valid"); bool evaluateAsExactMatch; string value = this.GetParsedValue(out evaluateAsExactMatch); @@ -158,7 +158,7 @@ protected internal RegexOptions GetRegexOptions() /// true if the specified data matches one of the specified patterns; otherwise, false. protected internal bool ExactMatchEvaluate(string data, string pattern, string exactMatchPattern) { - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "is valid"); var parsedPattern = this.GetRegexPattern(pattern, exactMatchPattern); var options = this.GetRegexOptions(); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs index e75809fa955..cf303a5f346 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs @@ -36,7 +36,7 @@ public TextStartsWithFilterRule() /// protected override bool Evaluate(string data) { - Debug.Assert(this.IsValid); + Debug.Assert(this.IsValid, "is valid"); return this.ExactMatchEvaluate(data, TextStartsWithCharactersRegexPattern, TextStartsWithWordsRegexPattern); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs index a7213cc6bd7..575e6b5b157 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs @@ -109,7 +109,7 @@ public override void StopFilter() private bool FilterExpressionAdapter(object item) { - Debug.Assert(this.CachedFilterExpression != null); + Debug.Assert(this.CachedFilterExpression != null, "not null"); try { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs index 28929d5cb78..d0440153eca 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs @@ -192,8 +192,8 @@ private bool TryGetCastValue(object rawValue, out T castValue) private bool TryGetEnumValue(object rawValue, out T castValue) { - Debug.Assert(rawValue != null); - Debug.Assert(typeof(T).IsEnum); + Debug.Assert(rawValue != null, "rawValue not null"); + Debug.Assert(typeof(T).IsEnum, "is enum"); castValue = default(T); diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs index 78f0088abe3..b005b9b0d24 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs @@ -304,7 +304,7 @@ private void UpdateValidationResult(string columnName) private void NotifyValidationResultUpdated() { - Debug.Assert(this.cachedValidationResult != null); + Debug.Assert(this.cachedValidationResult != null, "not null"); this.NotifyPropertyChanged("IsValid"); this.NotifyPropertyChanged("Error"); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs index eb60dfb8476..0d714cab400 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs @@ -235,7 +235,7 @@ private void Controller_FilterExpressionChanged(object sender, EventArgs e) partial void OnAddRulesExecutedImplementation(ExecutedRoutedEventArgs e) { - Debug.Assert(e != null); + Debug.Assert(e != null, "not null"); if (e.Parameter == null) { @@ -270,7 +270,7 @@ partial void OnAddRulesExecutedImplementation(ExecutedRoutedEventArgs e) partial void OnRemoveRuleExecutedImplementation(ExecutedRoutedEventArgs e) { - Debug.Assert(e != null); + Debug.Assert(e != null, "not null"); if (e.Parameter == null) { @@ -339,13 +339,13 @@ private void InitializeTemplatesForInputTypes() private void AddFilterRulePanelItemContentTemplate(Type type, string resourceName) { - Debug.Assert(type != null); - Debug.Assert(!string.IsNullOrEmpty(resourceName)); + Debug.Assert(type != null, "not null"); + Debug.Assert(!string.IsNullOrEmpty(resourceName), "not null"); var templateInfo = new ComponentResourceKey(typeof(FilterRulePanel), resourceName); DataTemplate template = (DataTemplate)this.TryFindResource(templateInfo); - Debug.Assert(template != null); + Debug.Assert(template != null, "not null"); this.AddFilterRulePanelItemContentTemplate(type, template); } @@ -356,7 +356,7 @@ private void AddFilterRulePanelItemContentTemplate(Type type, string resourceNam private void AddFilterRuleInternal(FilterRulePanelItem item) { - Debug.Assert(item != null); + Debug.Assert(item != null, "not null"); FilterRulePanelItem newItem = new FilterRulePanelItem(item.Rule.DeepCopy(), item.GroupId); this.Controller.AddFilterRulePanelItem(newItem); @@ -364,7 +364,7 @@ private void AddFilterRuleInternal(FilterRulePanelItem item) private void RemoveFilterRuleInternal(FilterRulePanelItem item) { - Debug.Assert(item != null); + Debug.Assert(item != null, "not null"); this.Controller.RemoveFilterRulePanelItem(item); } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs index ef10af8293a..532ac89c9df 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs @@ -172,8 +172,8 @@ private FilterExpressionNode CreateFilterExpression() private int GetExclusiveEndIndexForGroupStartingAt(int startIndex) { - Debug.Assert(this.filterRulePanelItems.Count > 0); - Debug.Assert(startIndex >= 0); + Debug.Assert(this.filterRulePanelItems.Count > 0, "greater than 0"); + Debug.Assert(startIndex >= 0, "greater than or equal to 0"); int i = startIndex; for (; i < this.filterRulePanelItems.Count; i++) @@ -197,9 +197,9 @@ private int GetExclusiveEndIndexForGroupStartingAt(int startIndex) private FilterExpressionOrOperatorNode CreateFilterExpressionForGroup(int startIndex, int endIndex) { - Debug.Assert(this.filterRulePanelItems.Count > 0); - Debug.Assert(startIndex >= 0); - Debug.Assert(this.filterRulePanelItems.Count >= endIndex); + Debug.Assert(this.filterRulePanelItems.Count > 0, "greater than 0"); + Debug.Assert(startIndex >= 0, "greater than or equal to 0"); + Debug.Assert(this.filterRulePanelItems.Count >= endIndex, "greater than or equal to endIndex"); FilterExpressionOrOperatorNode groupNode = new FilterExpressionOrOperatorNode(); for (int i = startIndex; i < endIndex; i++) @@ -220,7 +220,7 @@ private FilterExpressionOrOperatorNode CreateFilterExpressionForGroup(int startI private int GetInsertionIndex(FilterRulePanelItem item) { - Debug.Assert(item != null); + Debug.Assert(item != null, "not null"); for (int i = this.filterRulePanelItems.Count - 1; i >= 0; i--) { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs index 3e07d26b3e7..198f4fa318d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs @@ -105,7 +105,7 @@ public FilterRulePanelItem(FilterRule rule, string groupId) /// protected void NotifyPropertyChanged(string propertyName) { - Debug.Assert(!string.IsNullOrEmpty(propertyName)); + Debug.Assert(!string.IsNullOrEmpty(propertyName), "not null"); PropertyChangedEventHandler eh = this.PropertyChanged; if (eh != null) diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs index d4778260607..ee6502d3040 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs @@ -71,7 +71,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste private bool IsOfTypeValidatingValue(object value) { - Debug.Assert(value != null); + Debug.Assert(value != null, "not null"); Type type = value.GetType(); if (type.IsGenericType == false) @@ -86,8 +86,8 @@ private bool IsOfTypeValidatingValue(object value) private Type GetGenericParameter(object value, CultureInfo culture) { - Debug.Assert(value != null); - Debug.Assert(this.IsOfTypeValidatingValue(value)); + Debug.Assert(value != null, "not null"); + Debug.Assert(this.IsOfTypeValidatingValue(value), "not null"); return value.GetType().GetGenericArguments()[0]; } diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs index d0341e5d6ce..a585aff27ae 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ColumnPicker.xaml.cs @@ -201,7 +201,7 @@ internal void MoveDownButtonClick(object sender, RoutedEventArgs e) internal void AddButtonClick(object sender, RoutedEventArgs e) { InnerListColumn column = (InnerListColumn)this.PART_NotSelectedList.SelectedItem; - Debug.Assert(column != null); + Debug.Assert(column != null, "not null"); this.SelectedColumns.Add(column); this.NotSelectedColumns.Remove(column); @@ -231,9 +231,9 @@ internal void AddButtonClick(object sender, RoutedEventArgs e) internal void RemoveButtonClick(object sender, RoutedEventArgs e) { InnerListColumn column = (InnerListColumn)this.PART_SelectedList.SelectedItem; - Debug.Assert(column != null); + Debug.Assert(column != null, "not null"); int selectedIndex = this.PART_SelectedList.SelectedIndex; - Debug.Assert(selectedIndex >= 0); + Debug.Assert(selectedIndex >= 0, "greater than or equal to 0"); this.NotSelectedColumns.Add(column); this.SelectedColumns.Remove(column); @@ -247,7 +247,7 @@ internal void RemoveButtonClick(object sender, RoutedEventArgs e) } else if (selectedIndex > 0) { // Highest-index item removed, select previous item - Debug.Assert((selectedIndex - 1) < this.SelectedColumns.Count); + Debug.Assert((selectedIndex - 1) < this.SelectedColumns.Count, "less than count"); this.PART_SelectedList.SelectedIndex = selectedIndex - 1; } // otherwise there are no more items to select diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs index 75d046f7ef1..f949afe6430 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/InnerListGridView.cs @@ -158,7 +158,7 @@ internal void OnColumnPicker(object sender, RoutedEventArgs e) Debug.Assert(newColumns != null, "SelectedColumns not found"); foreach (InnerListColumn column in newColumns) { - Debug.Assert(column.Visible); + Debug.Assert(column.Visible, "is visible"); // 185977: ML InnerListGridView.PopulateColumns(): Always set Width on new columns // Workaround to GridView issue suggested by Ben Carter diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs index ba7d34aa16b..f3ba5ac347a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs @@ -282,7 +282,7 @@ private void RestoreColumnsOrder(ManagementList subject) List columnsCopy = new List(subject.List.Columns); InnerListColumnOrderComparer ilcc = new InnerListColumnOrderComparer(this.columns); columnsCopy.Sort(ilcc); - Debug.Assert(columnsCopy.Count == subject.List.Columns.Count); + Debug.Assert(columnsCopy.Count == subject.List.Columns.Count, "match count"); Utilities.ResortObservableCollection( subject.List.Columns, @@ -295,8 +295,9 @@ private void RestoreColumnsOrder(ManagementList subject) { columnsCopy.Add((InnerListColumn)gvc); } + columnsCopy.Sort(ilcc); - Debug.Assert(columnsCopy.Count == subject.List.InnerGrid.Columns.Count); + Debug.Assert(columnsCopy.Count == subject.List.InnerGrid.Columns.Count, "match count"); Utilities.ResortObservableCollection( subject.List.InnerGrid.Columns, diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs index 58db8d4f6e2..28d2523f459 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/OutGridView.cs @@ -210,10 +210,12 @@ private void ZoomEventHandlerPlus(object sender, ExecutedRoutedEventArgs e) { this.zoomLevel = 1; } + if (this.zoomLevel < ZOOM_MAX) { this.zoomLevel = this.zoomLevel + ZOOM_INCREMENT; Grid g = this.gridViewWindow.Content as Grid; + if (g != null) { g.LayoutTransform = new ScaleTransform(this.zoomLevel, this.zoomLevel, 0, 0); @@ -444,6 +446,7 @@ private void AddColumns(string[] propertyNames, string[] displayNames, Type[] ty { column = new InnerListColumn(new UIPropertyGroupDescription(propertyNames[i], displayNames[i], typeof(string))); } + this.managementList.AddColumn(column); } From 3f2add5d10f229c03b44de71a255aa595cf7a1ad Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Sat, 26 Oct 2019 10:03:13 -0700 Subject: [PATCH 18/22] sort using directives --- .../CommonHelper.cs | 2 +- .../HelpWindow/HelpParagraphBuilder.cs | 2 +- .../HelpWindow/HelpViewModel.cs | 2 +- .../HelpWindow/HelpWindow.xaml.cs | 2 +- .../HelpWindow/ParagraphBuilder.cs | 2 +- .../HelpWindow/ParagraphSearcher.cs | 2 +- .../HelpWindow/SettingsDialog.xaml.cs | 2 +- .../ManagementList/Common/AutomationButton.cs | 2 +- .../ManagementList/Common/BooleanBoxes.cs | 2 +- .../ManagementList/Common/CommandHelper.cs | 2 +- .../ManagementList/Common/CustomTypeComparer.cs | 2 +- .../ManagementList/Common/DataRoutedEventArgs.cs | 4 ++-- .../Common/DateTimeApproximationComparer.cs | 2 +- .../ManagementList/Common/DismissiblePopup.cs | 2 +- .../ManagementList/Common/IAsyncProgress.cs | 2 +- .../Common/IStateDescriptorFactory.cs | 2 +- .../ManagementList/Common/IntegralConverter.cs | 8 ++++---- .../Common/InverseBooleanConverter.cs | 2 +- .../ManagementList/Common/IsEqualConverter.cs | 4 ++-- .../ManagementList/Common/IsNotNullConverter.cs | 2 +- .../ManagementList/Common/KeyboardHelp.cs | 6 +++--- .../ManagementList/Common/ListOrganizer.cs | 2 +- .../ManagementList/Common/ListOrganizerItem.cs | 6 +++--- .../ManagementList/Common/PickerBase.cs | 12 ++++++------ .../ManagementList/Common/PopupControlButton.cs | 4 ++-- .../Common/PropertyChangedEventArgs.cs | 2 +- .../ManagementList/Common/ScalableImageSource.cs | 2 +- .../ManagementList/Common/StateDescriptor.cs | 4 ++-- .../ManagementList/Common/StringFormatConverter.cs | 2 +- .../ManagementList/Common/TextBlockService.cs | 8 ++++---- .../ManagementList/Common/TextTrimConverter.cs | 6 +++--- .../ManagementList/Common/Utilities.cs | 2 +- .../ManagementList/Common/WeakEventListener.cs | 2 +- .../ManagementList/Common/WpfHelp.cs | 14 +++++++------- .../CommonControls/AutomationGroup.cs | 2 +- .../CommonControls/ExpanderButton.cs | 2 +- .../ManagementList/CommonControls/Resizer.cs | 2 +- .../ResizerGripThicknessConverter.cs | 4 ++-- .../CommonControls/UIElementAdorner.cs | 4 ++-- .../DefaultFilterRuleCustomizationFactory.cs | 4 ++-- .../ManagementList/FilterCore/FilterEvaluator.cs | 2 +- .../FilterCore/FilterExceptionEventArgs.cs | 2 +- .../FilterExpressionAndOperatorNode.cs | 2 +- .../FilterExpressionNodes/FilterExpressionNode.cs | 4 ++-- .../FilterExpressionOperandNode.cs | 2 +- .../FilterExpressionOrOperatorNode.cs | 2 +- .../FilterCore/FilterRuleCustomizationFactory.cs | 2 +- .../FilterRules/ComparableValueFilterRule.cs | 2 +- .../FilterRules/DoesNotEqualFilterRule.cs | 2 +- .../FilterCore/FilterRules/EqualsFilterRule.cs | 2 +- .../FilterCore/FilterRules/FilterRule.cs | 2 +- .../FilterCore/FilterRules/FilterRuleExtensions.cs | 2 +- .../FilterCore/FilterRules/IsBetweenFilterRule.cs | 6 +++--- .../FilterCore/FilterRules/IsEmptyFilterRule.cs | 2 +- .../FilterRules/IsGreaterThanFilterRule.cs | 2 +- .../FilterCore/FilterRules/IsLessThanFilterRule.cs | 2 +- .../FilterCore/FilterRules/IsNotEmptyFilterRule.cs | 2 +- .../FilterRules/IsNotEmptyValidationRule.cs | 2 +- .../PropertiesTextContainsFilterRule.cs | 4 ++-- .../FilterRules/PropertyValueSelectorFilterRule.cs | 2 +- .../FilterCore/FilterRules/SelectorFilterRule.cs | 2 +- .../SingleValueComparableValueFilterRule.cs | 4 ++-- .../FilterRules/TextContainsFilterRule.cs | 2 +- .../FilterRules/TextDoesNotContainFilterRule.cs | 2 +- .../FilterRules/TextDoesNotEqualFilterRule.cs | 2 +- .../FilterRules/TextEndsWithFilterRule.cs | 2 +- .../FilterCore/FilterRules/TextEqualsFilterRule.cs | 2 +- .../FilterCore/FilterRules/TextFilterRule.cs | 6 +++--- .../FilterRules/TextStartsWithFilterRule.cs | 2 +- .../ManagementList/FilterCore/FilterStatus.cs | 2 +- .../ManagementList/FilterCore/FilterUtilities.cs | 2 +- .../ManagementList/FilterCore/IEvaluate.cs | 2 +- .../FilterCore/IFilterExpressionProvider.cs | 2 +- .../FilterCore/ItemsControlFilterEvaluator.cs | 2 +- .../FilterCore/ValidatingSelectorValue.cs | 2 +- .../ManagementList/FilterCore/ValidatingValue.cs | 4 ++-- .../FilterCore/ValidatingValueBase.cs | 4 ++-- .../DataErrorInfoValidationResult.cs | 2 +- .../ValidationRules/DataErrorInfoValidationRule.cs | 2 +- .../FilterProviders/AddFilterRulePicker.cs | 4 ++-- .../FilterProviders/AddFilterRulePickerItem.cs | 2 +- .../FilterProviders/FilterRulePanel.cs | 2 +- .../FilterRulePanelContentPresenter.cs | 2 +- .../FilterProviders/FilterRulePanelController.cs | 2 +- .../FilterProviders/FilterRulePanelItem.cs | 2 +- .../FilterProviders/FilterRulePanelItemType.cs | 2 +- .../FilterProviders/FilterRuleTemplateSelector.cs | 2 +- .../FilterRuleToDisplayNameConverter.cs | 2 +- .../InputFieldBackgroundTextConverter.cs | 6 +++--- .../IsValidatingValueValidConverter.cs | 4 ++-- .../ManagementList/FilterProviders/SearchBox.cs | 4 ++-- .../FilterProviders/SearchTextParseResult.cs | 2 +- .../FilterProviders/SearchTextParser.cs | 2 +- ...alidatingSelectorValueToDisplayNameConverter.cs | 2 +- ...lidatingValueToGenericParameterTypeConverter.cs | 2 +- .../ManagementList/IPropertyValueGetter.cs | 2 +- .../ManagementListStateDescriptor.cs | 2 +- .../ManagementListStateDescriptorFactory.cs | 2 +- .../ManagementList/UIPropertyGroupDescription.cs | 2 +- .../ManagementList/managementlist.cs | 2 +- .../ShowCommand/Controls/AllModulesControl.xaml.cs | 2 +- .../ShowCommand/Controls/CmdletControl.xaml.cs | 2 +- .../Controls/ImageButton/ImageButton.xaml.cs | 2 +- .../Controls/ImageButton/ImageButtonBase.cs | 2 +- .../Controls/ImageButton/ImageToggleButton.xaml.cs | 2 +- .../Controls/MultipleSelectionControl.xaml.cs | 2 +- .../Controls/NotImportedCmdletControl.xaml.cs | 2 +- .../Controls/ParameterSetControl.xaml.cs | 2 +- .../ShowCommand/Controls/ShowModuleControl.xaml.cs | 2 +- .../ShowCommand/ShowCommandSettings.Designer.cs | 2 +- .../ShowCommand/ViewModel/AllModulesViewModel.cs | 2 +- .../ShowCommand/ViewModel/CommandEventArgs.cs | 2 +- .../ShowCommand/ViewModel/CommandViewModel.cs | 3 ++- .../ShowCommand/ViewModel/HelpNeededEventArgs.cs | 2 +- .../ShowCommand/ViewModel/ImportModuleEventArgs.cs | 2 +- .../ShowCommand/ViewModel/ModuleViewModel.cs | 2 +- .../ShowCommand/ViewModel/ParameterSetViewModel.cs | 2 +- .../ShowCommand/ViewModel/ParameterViewModel.cs | 2 +- .../Windows/MultipleSelectionDialog.xaml.cs | 2 +- .../Windows/ShowAllModulesWindow.xaml.cs | 2 +- .../ShowCommand/Windows/ShowCommandWindow.xaml.cs | 2 +- .../commandHelpers/HelpWindowHelper.cs | 2 +- 122 files changed, 167 insertions(+), 166 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/CommonHelper.cs b/src/Microsoft.Management.UI.Internal/CommonHelper.cs index 59962734720..5455899beec 100644 --- a/src/Microsoft.Management.UI.Internal/CommonHelper.cs +++ b/src/Microsoft.Management.UI.Internal/CommonHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Windows; diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs index dfed9a66514..e459c6b3cdd 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpParagraphBuilder.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs index a5c83737de7..2c5a018f679 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpViewModel.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml.cs index c6d65e1d232..38f1f317d20 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindow.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Globalization; diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs index 53face17b96..eebc03afafe 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphBuilder.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphSearcher.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphSearcher.cs index e1e8a1b2b6f..055f05a98b2 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphSearcher.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/ParagraphSearcher.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Diagnostics; diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/SettingsDialog.xaml.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/SettingsDialog.xaml.cs index e6cca8ff1f1..663076af2e3 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/SettingsDialog.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/SettingsDialog.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace Microsoft.Management.UI diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/AutomationButton.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/AutomationButton.cs index d5e40a33721..dbfa42ed53c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/AutomationButton.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/AutomationButton.cs @@ -3,9 +3,9 @@ using System.ComponentModel; using System.Diagnostics.CodeAnalysis; +using System.Windows; using System.Windows.Automation.Peers; using System.Windows.Controls; -using System.Windows; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/BooleanBoxes.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/BooleanBoxes.cs index 1b42a5c5584..f75bad7e982 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/BooleanBoxes.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/BooleanBoxes.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace Microsoft.Management.UI.Internal diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CommandHelper.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CommandHelper.cs index 6452a022fc5..7316b3e50e9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CommandHelper.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CommandHelper.cs @@ -3,10 +3,10 @@ using System; using System.Collections.Generic; +using System.Security; using System.Text; using System.Windows; using System.Windows.Input; -using System.Security; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs index e52b52eaa5d..af9b02750b1 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/CustomTypeComparer.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DataRoutedEventArgs.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DataRoutedEventArgs.cs index efcb5bb6ad4..aefcb941741 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DataRoutedEventArgs.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DataRoutedEventArgs.cs @@ -1,11 +1,11 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Text; using System.Windows; -using System.Diagnostics.CodeAnalysis; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DateTimeApproximationComparer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DateTimeApproximationComparer.cs index c2cc3e94f22..9090f5764af 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DateTimeApproximationComparer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DateTimeApproximationComparer.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs index 7323bb6d05e..fa08b212e4a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/DismissiblePopup.cs @@ -6,9 +6,9 @@ using System.Windows; using System.Windows.Automation; using System.Windows.Controls.Primitives; +using System.Windows.Data; using System.Windows.Input; using System.Windows.Media; -using System.Windows.Data; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IAsyncProgress.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IAsyncProgress.cs index 920f2b07c91..4798e8e5c90 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IAsyncProgress.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IAsyncProgress.cs @@ -2,8 +2,8 @@ // Licensed under the MIT License. using System; -using System.Diagnostics.CodeAnalysis; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Text; using System.Windows; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IStateDescriptorFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IStateDescriptorFactory.cs index ce365a89799..cecccc6a7ee 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IStateDescriptorFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IStateDescriptorFactory.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs index 515f8459b45..caffb63b645 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IntegralConverter.cs @@ -1,13 +1,13 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; -using System.Text; -using System.Windows.Data; using System.Diagnostics.CodeAnalysis; -using System.Windows; using System.Globalization; +using System.Text; +using System.Windows; +using System.Windows.Data; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/InverseBooleanConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/InverseBooleanConverter.cs index 769af827f0e..c8f5f8e29e7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/InverseBooleanConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/InverseBooleanConverter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs index 5a8542c6dae..d340839f5f9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsEqualConverter.cs @@ -3,10 +3,10 @@ using System; using System.Collections.Generic; -using System.Text; -using System.Windows.Data; using System.Diagnostics.CodeAnalysis; +using System.Text; using System.Windows; +using System.Windows.Data; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs index 18461f24d6b..21371fee76f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/IsNotNullConverter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs index 46c15439268..3de99caeb4f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/KeyboardHelp.cs @@ -1,12 +1,12 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; -using System.Text; -using System.Windows.Input; using System.Diagnostics; +using System.Text; using System.Windows; +using System.Windows.Input; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.cs index 624d4d6ec5a..67ad950fbc8 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizer.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs index 05b2781b44a..fad63be68e4 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ListOrganizerItem.cs @@ -1,13 +1,13 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; +using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Input; -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.cs index e09d7697f42..5644faa91e0 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PickerBase.cs @@ -1,17 +1,17 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; -using System.Windows; using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Text; +using System.Windows; using System.Windows.Controls; -using System.Windows.Input; -using System.Windows.Data; using System.Windows.Controls.Primitives; -using System.Diagnostics; +using System.Windows.Data; +using System.Windows.Input; using System.Windows.Threading; -using System.Diagnostics.CodeAnalysis; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs index 0a7da15ede7..66cb1ef10e6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PopupControlButton.cs @@ -3,11 +3,11 @@ using System; using System.ComponentModel; +using System.Diagnostics; using System.Windows; using System.Windows.Controls.Primitives; -using System.Diagnostics; -using System.Windows.Threading; using System.Windows.Input; +using System.Windows.Threading; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PropertyChangedEventArgs.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PropertyChangedEventArgs.cs index b3c3758659d..010c69f6a4e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/PropertyChangedEventArgs.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/PropertyChangedEventArgs.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace Microsoft.Management.UI.Internal diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImageSource.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImageSource.cs index 49598c75708..1587c5feb5b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImageSource.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/ScalableImageSource.cs @@ -8,8 +8,8 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Media; -using System.Windows.Media.Imaging; using System.Windows.Media.Animation; +using System.Windows.Media.Imaging; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/StateDescriptor.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/StateDescriptor.cs index 032f40f3f8e..fedb4f97138 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/StateDescriptor.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/StateDescriptor.cs @@ -1,10 +1,10 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; -using System.Text; using System.Diagnostics.CodeAnalysis; +using System.Text; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/StringFormatConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/StringFormatConverter.cs index 40469afb962..ec7e43a9003 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/StringFormatConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/StringFormatConverter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs index ed48a9db9b7..3128c944703 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextBlockService.cs @@ -1,13 +1,13 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Windows; using System.Windows.Controls; using System.Windows.Media; -using System.Diagnostics.CodeAnalysis; -using System.ComponentModel; -using System.Diagnostics; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextTrimConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextTrimConverter.cs index 861c993e7a4..41e4c812e38 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextTrimConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/TextTrimConverter.cs @@ -1,13 +1,13 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; +using System.Collections; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; using System.Windows.Data; -using System.Collections; -using System.Diagnostics.CodeAnalysis; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/Utilities.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/Utilities.cs index f9e4966b872..665c9b3c76c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/Utilities.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/Utilities.cs @@ -9,8 +9,8 @@ using System.Diagnostics.CodeAnalysis; using System.Text; using System.Windows; -using System.Windows.Media; using System.Windows.Controls; +using System.Windows.Media; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs index 6bb02eda9d7..3f69908d5c9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WeakEventListener.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs index f50d2a51146..01f96bfa1f7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/Common/WpfHelp.cs @@ -3,19 +3,19 @@ using System; using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Windows; -using System.Windows.Controls; -using System.Diagnostics; -using System.Windows.Media; -using System.Windows.Data; -using System.ComponentModel; -using System.Windows.Controls.Primitives; -using System.Windows.Threading; using System.Windows.Automation; using System.Windows.Automation.Peers; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Threading; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/AutomationGroup.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/AutomationGroup.cs index e7ed8fc5bae..90bcd753e9b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/AutomationGroup.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/AutomationGroup.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Windows.Automation.Peers; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ExpanderButton.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ExpanderButton.cs index 82a574c92a8..e47ed8b4316 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ExpanderButton.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ExpanderButton.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Windows; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs index d2bfdf8f6f7..6a7de4b6400 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/Resizer.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs index d1565c2f9f5..7b496a2f9a2 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/ResizerGripThicknessConverter.cs @@ -1,10 +1,10 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Globalization; -using System.Windows.Data; using System.Windows; +using System.Windows.Data; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs index 57b8c934bf0..eca9dc151d6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/CommonControls/UIElementAdorner.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; @@ -6,8 +6,8 @@ using System.Linq; using System.Text; using System.Windows; -using System.Windows.Media; using System.Windows.Documents; +using System.Windows.Media; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs index cd0915db76d..7fc17d01ea2 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/DefaultFilterRuleCustomizationFactory.cs @@ -1,12 +1,12 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; -using System.Reflection; using System.Globalization; +using System.Reflection; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs index d3d0c37ff09..14246932829 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterEvaluator.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExceptionEventArgs.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExceptionEventArgs.cs index 50d33f6a964..f2694bd152f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExceptionEventArgs.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExceptionEventArgs.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs index 63e76f79249..24262acc43d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionAndOperatorNode.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionNode.cs index a4a1a6ddac4..f4a30df084d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionNode.cs @@ -1,9 +1,9 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Diagnostics.CodeAnalysis; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Diagnostics.CodeAnalysis; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs index d11a3a229aa..fa021cb747d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOperandNode.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs index d5d7646953a..aa052436ff9 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterExpressionNodes/FilterExpressionOrOperatorNode.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs index 116da6bb28d..6019d06e528 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRuleCustomizationFactory.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs index e6d6171148f..419c9c8987f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/ComparableValueFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs index cc311d09cd7..3263dfc77bd 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/DoesNotEqualFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs index 8f82fb8fa24..d119e0d8bcb 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/EqualsFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs index ccd6bcc3e52..2e21b412bf5 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs index c62535b3b49..19452a49656 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/FilterRuleExtensions.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs index 3bd47740491..6d73a582a3a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsBetweenFilterRule.cs @@ -1,10 +1,10 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; -using System.Runtime.Serialization; -using System.Diagnostics; using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.Serialization; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs index 5db9fc45d47..311c8198bd8 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsEmptyFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs index 3492e81bdb5..0d4ae3f8a09 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsGreaterThanFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs index 621904b104b..936d9380ca4 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsLessThanFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs index ff4b7173f8f..537713f420c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs index 030e37ee2e2..8a4137051c8 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/IsNotEmptyValidationRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs index 591af61a723..1530991ca15 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertiesTextContainsFilterRule.cs @@ -1,10 +1,10 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; -using System.Text.RegularExpressions; using System.Runtime.Serialization; +using System.Text.RegularExpressions; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs index 4526d239337..4d8b4c77405 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/PropertyValueSelectorFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs index c229cc421b9..6bb5c0a4634 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SelectorFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs index f7bc14fd9cc..abfc83ba2bf 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/SingleValueComparableValueFilterRule.cs @@ -1,9 +1,9 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; -using System.Runtime.Serialization; using System.ComponentModel; +using System.Runtime.Serialization; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs index 86d4a160e1c..2de7780da52 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextContainsFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs index 7e4851ec1b3..d2bc1973d5f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotContainFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs index 61f373e4496..57f8db3972f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextDoesNotEqualFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs index 55fb7c5abc5..9bb052cc248 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEndsWithFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs index d95546d173d..5b6132b2ce2 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextEqualsFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs index 2c0cd9b618c..cf9d66a7293 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextFilterRule.cs @@ -1,11 +1,11 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; +using System.ComponentModel; +using System.Diagnostics; using System.Globalization; using System.Text.RegularExpressions; -using System.Diagnostics; -using System.ComponentModel; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs index cf303a5f346..549c5cc637d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterRules/TextStartsWithFilterRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterStatus.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterStatus.cs index 0ea66e3c9fb..6fc01dfc03a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterStatus.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterStatus.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace Microsoft.Management.UI.Internal diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterUtilities.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterUtilities.cs index 362b67ec145..f1435ffd2f3 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterUtilities.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/FilterUtilities.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/IEvaluate.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/IEvaluate.cs index 0364a4954b6..195e27b2598 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/IEvaluate.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/IEvaluate.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace Microsoft.Management.UI.Internal diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/IFilterExpressionProvider.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/IFilterExpressionProvider.cs index 1c9e5b85acd..4063fd84a40 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/IFilterExpressionProvider.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/IFilterExpressionProvider.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs index 575e6b5b157..ad8ec4d3d9e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ItemsControlFilterEvaluator.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs index 2e89ceaa03f..7edb2e62a4c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingSelectorValue.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs index d0440153eca..c429cc44854 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValue.cs @@ -1,9 +1,9 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; -using System.Globalization; using System.Diagnostics; +using System.Globalization; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs index b005b9b0d24..f2ca5b67f2a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidatingValueBase.cs @@ -1,12 +1,12 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Globalization; using System.Diagnostics; +using System.Globalization; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs index 20cbb4641fb..8b1ab8f17a6 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationResult.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs index 40f20f61c19..42b7b14d9d3 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterCore/ValidationRules/DataErrorInfoValidationRule.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs index 8ea2726205c..d6bab1e092d 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePicker.cs @@ -1,9 +1,9 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; -using System.ComponentModel; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Windows.Controls; namespace Microsoft.Management.UI.Internal diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs index 91bf4868893..6f732a3358e 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/AddFilterRulePickerItem.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.ComponentModel; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs index 0d714cab400..fb27cd19c8c 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanel.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs index 235a3cf5262..1783b366d3b 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelContentPresenter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Windows; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs index 532ac89c9df..157424b3221 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelController.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs index 198f4fa318d..8d45204a7a5 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItem.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItemType.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItemType.cs index fe5ac131134..341005abaf8 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItemType.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRulePanelItemType.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace Microsoft.Management.UI.Internal diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs index 8cfbd0a7ab1..0e9773664c2 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleTemplateSelector.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs index c68de49cfef..5434ffc9754 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/FilterRuleToDisplayNameConverter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs index ee6502d3040..20130a7823f 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/InputFieldBackgroundTextConverter.cs @@ -1,12 +1,12 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; -using System.Text; -using System.Windows.Data; using System.Diagnostics; using System.Globalization; +using System.Text; +using System.Windows.Data; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs index f51e3cc3d5d..8495139b768 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/IsValidatingValueValidConverter.cs @@ -1,9 +1,9 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; -using System.Windows.Data; using System.Globalization; +using System.Windows.Data; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs index 64bfc9ac724..2472dcb17dc 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchBox.cs @@ -1,12 +1,12 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; +using System.ComponentModel; using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using System.ComponentModel; namespace Microsoft.Management.UI.Internal { diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParseResult.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParseResult.cs index 97c51d67149..1af2103eab7 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParseResult.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParseResult.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParser.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParser.cs index 53bdb8070f0..5a34b0ca985 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParser.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/SearchTextParser.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs index 19a968380e1..c62ef7f144a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingSelectorValueToDisplayNameConverter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs index c290765beb6..6d56afd4f22 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/FilterProviders/ValidatingValueToGenericParameterTypeConverter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/IPropertyValueGetter.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/IPropertyValueGetter.cs index db6acff0a16..03051218587 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/IPropertyValueGetter.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/IPropertyValueGetter.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace Microsoft.Management.UI.Internal diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs index f3ba5ac347a..706fd59412a 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptor.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptorFactory.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptorFactory.cs index 2588f3d0e6e..276cb798452 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptorFactory.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/ManagementListStateDescriptorFactory.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. namespace Microsoft.Management.UI.Internal diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/UIPropertyGroupDescription.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/UIPropertyGroupDescription.cs index b3a5230fabb..4d6b3cb54a1 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/UIPropertyGroupDescription.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/UIPropertyGroupDescription.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs index 3d223b67b2e..8513a758fe4 100644 --- a/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs +++ b/src/Microsoft.Management.UI.Internal/ManagementList/ManagementList/managementlist.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/AllModulesControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/AllModulesControl.xaml.cs index 72fe58b264f..2283d9dce75 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/AllModulesControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/AllModulesControl.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.ComponentModel; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/CmdletControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/CmdletControl.xaml.cs index c69f020904b..9c1a9fc5c4f 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/CmdletControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/CmdletControl.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Windows; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs index 241ef0b4020..1d0fb21d7b6 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButton.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Diagnostics.CodeAnalysis; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonBase.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonBase.cs index 8369160bff0..f4eadf03537 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonBase.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageButtonBase.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs index 77c6272cefd..8fd4201c6ea 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ImageButton/ImageToggleButton.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Diagnostics.CodeAnalysis; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml.cs index 0ee8fcbacd1..0aafd9184d7 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/MultipleSelectionControl.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Globalization; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/NotImportedCmdletControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/NotImportedCmdletControl.xaml.cs index 70e7752b5d4..24eab391100 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/NotImportedCmdletControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/NotImportedCmdletControl.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Windows.Controls; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs index 1e041c05c3d..e13d1e589ca 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ParameterSetControl.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs index 8cb7c2eb611..f63faf9d6a7 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Controls/ShowModuleControl.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Management.Automation; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs index d05a4d8ff35..ec9b7029dcc 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.16808 diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs index 01fcd123c5e..dc6c29fb39d 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/AllModulesViewModel.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandEventArgs.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandEventArgs.cs index 52fad0cc159..5fe69bea162 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandEventArgs.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandEventArgs.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs index e329d974d72..e86bb257e75 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/CommandViewModel.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; @@ -11,6 +11,7 @@ using System.Management.Automation; using System.Text; using System.Windows; + using Microsoft.Management.UI; using Microsoft.Management.UI.Internal; using Microsoft.PowerShell.Commands.ShowCommandExtension; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/HelpNeededEventArgs.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/HelpNeededEventArgs.cs index 4fd1977b95d..d5d2fa66f83 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/HelpNeededEventArgs.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/HelpNeededEventArgs.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ImportModuleEventArgs.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ImportModuleEventArgs.cs index 27d99b7abe8..82095868c66 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ImportModuleEventArgs.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ImportModuleEventArgs.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs index 6b62b01d000..f15058a8103 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ModuleViewModel.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs index 586c9f66d79..0ef79083b37 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterSetViewModel.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs index bab5f1636fc..a366c60b49c 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ViewModel/ParameterViewModel.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml.cs index d6e51ce6368..3021114b47c 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/MultipleSelectionDialog.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Windows; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs index 1866becc264..82c8eb0c998 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowAllModulesWindow.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowCommandWindow.xaml.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowCommandWindow.xaml.cs index 79025d536d4..0d2000cedbc 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowCommandWindow.xaml.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/Windows/ShowCommandWindow.xaml.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System.Windows; diff --git a/src/Microsoft.Management.UI.Internal/commandHelpers/HelpWindowHelper.cs b/src/Microsoft.Management.UI.Internal/commandHelpers/HelpWindowHelper.cs index 3a7fbd61d3a..03daefdfb69 100644 --- a/src/Microsoft.Management.UI.Internal/commandHelpers/HelpWindowHelper.cs +++ b/src/Microsoft.Management.UI.Internal/commandHelpers/HelpWindowHelper.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; From 4b9510ce42a050102b06e3350cac9166a81e497e Mon Sep 17 00:00:00 2001 From: "Steve Lee (POWERSHELL)" Date: Sat, 26 Oct 2019 10:50:52 -0700 Subject: [PATCH 19/22] add copyright header --- .../HelpWindow/HelpWindowSettings.Designer.cs | 7 ++--- .../ShowCommandSettings.Designer.cs | 30 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindowSettings.Designer.cs b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindowSettings.Designer.cs index 865990c0086..03f214dd60d 100644 --- a/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindowSettings.Designer.cs +++ b/src/Microsoft.Management.UI.Internal/HelpWindow/HelpWindowSettings.Designer.cs @@ -1,7 +1,6 @@ -// -// Copyright (C) Microsoft. All rights reserved. -// -//------------------------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.16598 diff --git a/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs b/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs index ec9b7029dcc..589fb63b52c 100644 --- a/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs +++ b/src/Microsoft.Management.UI.Internal/ShowCommand/ShowCommandSettings.Designer.cs @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. //------------------------------------------------------------------------------ // // This code was generated by a tool. @@ -9,20 +11,20 @@ //------------------------------------------------------------------------------ namespace Microsoft.Management.UI.Internal.ShowCommand { - - + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] internal sealed partial class ShowCommandSettings : global::System.Configuration.ApplicationSettingsBase { - + private static ShowCommandSettings defaultInstance = ((ShowCommandSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new ShowCommandSettings()))); - + public static ShowCommandSettings Default { get { return defaultInstance; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] @@ -34,7 +36,7 @@ public double ShowOneCommandTop { this["ShowOneCommandTop"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] @@ -46,7 +48,7 @@ public double ShowOneCommandLeft { this["ShowOneCommandLeft"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] @@ -58,7 +60,7 @@ public double ShowOneCommandWidth { this["ShowOneCommandWidth"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] @@ -70,7 +72,7 @@ public double ShowOneCommandHeight { this["ShowOneCommandHeight"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] @@ -82,7 +84,7 @@ public double ShowCommandsTop { this["ShowCommandsTop"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] @@ -94,7 +96,7 @@ public double ShowCommandsLeft { this["ShowCommandsLeft"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] @@ -106,7 +108,7 @@ public double ShowCommandsWidth { this["ShowCommandsWidth"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("-1")] @@ -118,7 +120,7 @@ public double ShowCommandsHeight { this["ShowCommandsHeight"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] @@ -130,7 +132,7 @@ public bool ShowCommandsWindowMaximized { this["ShowCommandsWindowMaximized"] = value; } } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("False")] From df239709327198995196c8980db3ee31754c3e0b Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 28 Oct 2019 17:49:05 -0700 Subject: [PATCH 20/22] update fwlink --- .../utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs index 54bd7f576e3..ae0d1c2c229 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutGridViewCommand.cs @@ -36,7 +36,7 @@ public enum OutputModeOption /// /// Implementation for the Out-GridView command. /// - [Cmdlet(VerbsData.Out, "GridView", DefaultParameterSetName = "PassThru", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=113364")] + [Cmdlet(VerbsData.Out, "GridView", DefaultParameterSetName = "PassThru", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2109378")] public class OutGridViewCommand : PSCmdlet, IDisposable { #region Properties From 5f34e80fd28457f4074e5e6493b9e3e7379064b5 Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 28 Oct 2019 19:47:06 -0700 Subject: [PATCH 21/22] update help test --- test/powershell/engine/Help/assets/HelpURI/V2Cmdlets.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/powershell/engine/Help/assets/HelpURI/V2Cmdlets.csv b/test/powershell/engine/Help/assets/HelpURI/V2Cmdlets.csv index d663fb8fcd5..8119ef10d1a 100644 --- a/test/powershell/engine/Help/assets/HelpURI/V2Cmdlets.csv +++ b/test/powershell/engine/Help/assets/HelpURI/V2Cmdlets.csv @@ -143,7 +143,7 @@ New-WSManSessionOption,https://go.microsoft.com/fwlink/?LinkID=141449 Object Pipeline,https://go.microsoft.com/fwlink/?LinkID=135239 Out-Default,https://go.microsoft.com/fwlink/?LinkID=113362 Out-File,https://go.microsoft.com/fwlink/?LinkID=113363 -Out-GridView,https://go.microsoft.com/fwlink/?LinkID=113364 +Out-GridView,https://go.microsoft.com/fwlink/?LinkID=2109378 Out-Host,https://go.microsoft.com/fwlink/?LinkID=113365 Out-Null,https://go.microsoft.com/fwlink/?LinkID=113366 Out-Printer,https://go.microsoft.com/fwlink/?LinkID=113367 From 60dd857b3f209b1be4124b57be7e8fa49b9d878f Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Mon, 28 Oct 2019 20:42:35 -0700 Subject: [PATCH 22/22] update show-command fwlink --- .../commands/utility/ShowCommand/ShowCommand.cs | 2 +- test/powershell/engine/Help/assets/HelpURI/V3Cmdlets.csv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs index a10dfa7b892..2e260c5953d 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommand.cs @@ -18,7 +18,7 @@ namespace Microsoft.PowerShell.Commands /// /// Show-Command displays a GUI for a cmdlet, or for all cmdlets if no specific cmdlet is specified. /// - [Cmdlet(VerbsCommon.Show, "Command", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=217448")] + [Cmdlet(VerbsCommon.Show, "Command", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2109589")] public class ShowCommandCommand : PSCmdlet, IDisposable { #region Private Fields diff --git a/test/powershell/engine/Help/assets/HelpURI/V3Cmdlets.csv b/test/powershell/engine/Help/assets/HelpURI/V3Cmdlets.csv index 08519e6a4b0..34594d8ca57 100644 --- a/test/powershell/engine/Help/assets/HelpURI/V3Cmdlets.csv +++ b/test/powershell/engine/Help/assets/HelpURI/V3Cmdlets.csv @@ -42,7 +42,7 @@ Set-ContentFileSystem,https://go.microsoft.com/fwlink/?LinkID=204570 Set-JobTrigger,https://go.microsoft.com/fwlink/?LinkID=223916 Set-ScheduledJob,https://go.microsoft.com/fwlink/?LinkID=223924 Set-ScheduledJobOption,https://go.microsoft.com/fwlink/?LinkID=223921 -Show-Command,https://go.microsoft.com/fwlink/?LinkID=217448 +Show-Command,https://go.microsoft.com/fwlink/?LinkID=2109589 Show-ControlPanelItem,https://go.microsoft.com/fwlink/?LinkID=219983 Suspend-Job,https://go.microsoft.com/fwlink/?LinkID=210613 Test-PSSessionConfigurationFile,https://go.microsoft.com/fwlink/?LinkID=217039