From dae63ce3b99aefe0fde59d81081a35c81d0e5080 Mon Sep 17 00:00:00 2001 From: CleanCodeDeveloper <16760760+CleanCodeDeveloper@users.noreply.github.com> Date: Tue, 9 Aug 2022 06:35:46 +0200 Subject: [PATCH] Remove fxcop leftovers (#19772) * Fixed FxCop leftovers * Fixed FxCop leftovers --- .../ViewModels/FancyZonesViewModel.cs | 20 ++++--------------- .../ViewModels/MouseUtilsViewModel.cs | 20 ++++--------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/settings-ui/Settings.UI.Library/ViewModels/FancyZonesViewModel.cs b/src/settings-ui/Settings.UI.Library/ViewModels/FancyZonesViewModel.cs index 871b4b4e70..d07643dce4 100644 --- a/src/settings-ui/Settings.UI.Library/ViewModels/FancyZonesViewModel.cs +++ b/src/settings-ui/Settings.UI.Library/ViewModels/FancyZonesViewModel.cs @@ -643,10 +643,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels set { - // The fallback value is based on ToRGBHex's behavior, which returns - // #FFFFFF if any exceptions are encountered, e.g. from passing in a null value. - // This extra handling is added here to deal with FxCop warnings. - value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF"; + value = SettingsUtilities.ToRGBHex(value); if (!value.Equals(_zoneHighlightColor, StringComparison.OrdinalIgnoreCase)) { _zoneHighlightColor = value; @@ -665,10 +662,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels set { - // The fallback value is based on ToRGBHex's behavior, which returns - // #FFFFFF if any exceptions are encountered, e.g. from passing in a null value. - // This extra handling is added here to deal with FxCop warnings. - value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF"; + value = SettingsUtilities.ToRGBHex(value); if (!value.Equals(_zoneBorderColor, StringComparison.OrdinalIgnoreCase)) { _zoneBorderColor = value; @@ -687,10 +681,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels set { - // The fallback value is based on ToRGBHex's behavior, which returns - // #FFFFFF if any exceptions are encountered, e.g. from passing in a null value. - // This extra handling is added here to deal with FxCop warnings. - value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF"; + value = SettingsUtilities.ToRGBHex(value); if (!value.Equals(_zoneInActiveColor, StringComparison.OrdinalIgnoreCase)) { _zoneInActiveColor = value; @@ -709,10 +700,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels set { - // The fallback value is based on ToRGBHex's behavior, which returns - // #FFFFFF if any exceptions are encountered, e.g. from passing in a null value. - // This extra handling is added here to deal with FxCop warnings. - value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF"; + value = SettingsUtilities.ToRGBHex(value); if (!value.Equals(_zoneNumberColor, StringComparison.OrdinalIgnoreCase)) { _zoneNumberColor = value; diff --git a/src/settings-ui/Settings.UI.Library/ViewModels/MouseUtilsViewModel.cs b/src/settings-ui/Settings.UI.Library/ViewModels/MouseUtilsViewModel.cs index de646cd8f4..51e53e6f49 100644 --- a/src/settings-ui/Settings.UI.Library/ViewModels/MouseUtilsViewModel.cs +++ b/src/settings-ui/Settings.UI.Library/ViewModels/MouseUtilsViewModel.cs @@ -360,10 +360,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels set { - // The fallback value is based on ToRGBHex's behavior, which returns - // #FFFFFF if any exceptions are encountered, e.g. from passing in a null value. - // This extra handling is added here to deal with FxCop warnings. - value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF"; + value = SettingsUtilities.ToRGBHex(value); if (!value.Equals(_highlighterLeftButtonClickColor, StringComparison.OrdinalIgnoreCase)) { _highlighterLeftButtonClickColor = value; @@ -382,10 +379,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels set { - // The fallback value is based on ToRGBHex's behavior, which returns - // #FFFFFF if any exceptions are encountered, e.g. from passing in a null value. - // This extra handling is added here to deal with FxCop warnings. - value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF"; + value = SettingsUtilities.ToRGBHex(value); if (!value.Equals(_highlighterRightButtonClickColor, StringComparison.OrdinalIgnoreCase)) { _highlighterRightButtonClickColor = value; @@ -523,10 +517,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels set { - // The fallback value is based on ToRGBHex's behavior, which returns - // #FFFFFF if any exceptions are encountered, e.g. from passing in a null value. - // This extra handling is added here to deal with FxCop warnings. - value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF"; + value = SettingsUtilities.ToRGBHex(value); if (!value.Equals(_mousePointerCrosshairsColor, StringComparison.OrdinalIgnoreCase)) { _mousePointerCrosshairsColor = value; @@ -599,10 +590,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels set { - // The fallback value is based on ToRGBHex's behavior, which returns - // #FFFFFF if any exceptions are encountered, e.g. from passing in a null value. - // This extra handling is added here to deal with FxCop warnings. - value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF"; + value = SettingsUtilities.ToRGBHex(value); if (!value.Equals(_mousePointerCrosshairsBorderColor, StringComparison.OrdinalIgnoreCase)) { _mousePointerCrosshairsBorderColor = value;