From 433e2e57edae63160162687c67aa8445b1efab7a Mon Sep 17 00:00:00 2001 From: Mykhailo Pylyp Date: Wed, 20 Jan 2021 11:23:56 +0200 Subject: [PATCH] Delete Fody and PropertyChanged.Fody (#9120) --- .../launcher/PowerLauncher/FodyWeavers.xml | 4 - .../launcher/PowerLauncher/FodyWeavers.xsd | 74 ------------------- .../PowerLauncher/PowerLauncher.csproj | 7 -- .../ViewModel/ContextMenuItemViewModel.cs | 45 ++++++++++- .../PowerLauncher/ViewModel/MainViewModel.cs | 53 ++++++++++++- .../ViewModel/ResultViewModel.cs | 30 +++++++- .../ViewModel/ResultsViewModel.cs | 30 +++++++- .../UserSettings/PowerToysRunSettings.cs | 19 ++++- .../launcher/Wox.Plugin/FodyWeavers.xml | 4 - .../launcher/Wox.Plugin/FodyWeavers.xsd | 74 ------------------- .../launcher/Wox.Plugin/Wox.Plugin.csproj | 7 -- 11 files changed, 163 insertions(+), 184 deletions(-) delete mode 100644 src/modules/launcher/PowerLauncher/FodyWeavers.xml delete mode 100644 src/modules/launcher/PowerLauncher/FodyWeavers.xsd delete mode 100644 src/modules/launcher/Wox.Plugin/FodyWeavers.xml delete mode 100644 src/modules/launcher/Wox.Plugin/FodyWeavers.xsd diff --git a/src/modules/launcher/PowerLauncher/FodyWeavers.xml b/src/modules/launcher/PowerLauncher/FodyWeavers.xml deleted file mode 100644 index 4e68ed1a8b..0000000000 --- a/src/modules/launcher/PowerLauncher/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/modules/launcher/PowerLauncher/FodyWeavers.xsd b/src/modules/launcher/PowerLauncher/FodyWeavers.xsd deleted file mode 100644 index b1a47f932d..0000000000 --- a/src/modules/launcher/PowerLauncher/FodyWeavers.xsd +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - Used to control if the On_PropertyName_Changed feature is enabled. - - - - - Used to control if the Dependent properties feature is enabled. - - - - - Used to control if the IsChanged property feature is enabled. - - - - - Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form. - - - - - Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project. - - - - - Used to control if equality checks should use the Equals method resolved from the base class. - - - - - Used to control if equality checks should use the static Equals method resolved from the base class. - - - - - Used to turn off build warnings from this weaver. - - - - - Used to turn off build warnings about mismatched On_PropertyName_Changed methods. - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj index 44fdefbdc3..423adf266f 100644 --- a/src/modules/launcher/PowerLauncher/PowerLauncher.csproj +++ b/src/modules/launcher/PowerLauncher/PowerLauncher.csproj @@ -88,10 +88,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - NU1701 @@ -108,9 +104,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - all - diff --git a/src/modules/launcher/PowerLauncher/ViewModel/ContextMenuItemViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/ContextMenuItemViewModel.cs index 2b4a10cd7c..239a978a99 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/ContextMenuItemViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/ContextMenuItemViewModel.cs @@ -15,11 +15,50 @@ namespace PowerLauncher.ViewModel public string PluginName { get; set; } - public string Title { get; set; } + private string _title; - public string Glyph { get; set; } + public string Title + { + get => _title; + set + { + if (_title != value) + { + _title = value; + OnPropertyChanged(nameof(Title)); + } + } + } - public string FontFamily { get; set; } + private string _glyph; + + public string Glyph + { + get => _glyph; + set + { + if (_glyph != value) + { + _glyph = value; + OnPropertyChanged(nameof(Glyph)); + } + } + } + + private string _fontFamily; + + public string FontFamily + { + get => _fontFamily; + set + { + if (_fontFamily != value) + { + _fontFamily = value; + OnPropertyChanged(nameof(FontFamily)); + } + } + } public ICommand Command { diff --git a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs index 882fe8f466..a947197447 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/MainViewModel.cs @@ -296,15 +296,55 @@ namespace PowerLauncher.ViewModel public Brush MainWindowBorderBrush { get; set; } - public ResultsViewModel Results { get; private set; } + private ResultsViewModel _results; + + public ResultsViewModel Results + { + get => _results; + private set + { + if (value != _results) + { + _results = value; + OnPropertyChanged(nameof(Results)); + } + } + } public ResultsViewModel ContextMenu { get; private set; } public ResultsViewModel History { get; private set; } - public string SystemQueryText { get; set; } = string.Empty; + private string _systemQueryText = string.Empty; - public string QueryText { get; set; } = string.Empty; + public string SystemQueryText + { + get => _systemQueryText; + set + { + if (_systemQueryText != value) + { + _systemQueryText = value; + OnPropertyChanged(nameof(SystemQueryText)); + } + } + } + + private string _queryText = string.Empty; + + public string QueryText + { + get => _queryText; + + set + { + if (_queryText != value) + { + _queryText = value; + OnPropertyChanged(nameof(QueryText)); + } + } + } /// /// we need move cursor to end when we manually changed query @@ -380,7 +420,12 @@ namespace PowerLauncher.ViewModel set { - _visibility = value; + if (_visibility != value) + { + _visibility = value; + OnPropertyChanged(nameof(MainWindowVisibility)); + } + if (value == Visibility.Visible) { PowerToysTelemetry.Log.WriteEvent(new LauncherShowEvent()); diff --git a/src/modules/launcher/PowerLauncher/ViewModel/ResultViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/ResultViewModel.cs index b089aa643f..d9f18dc957 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/ResultViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/ResultViewModel.cs @@ -36,9 +36,35 @@ namespace PowerLauncher.ViewModel public bool IsHovered { get; set; } - public bool AreContextButtonsActive { get; set; } + private bool _areContextButtonsActive; - public int ContextMenuSelectedIndex { get; set; } + public bool AreContextButtonsActive + { + get => _areContextButtonsActive; + set + { + if (_areContextButtonsActive != value) + { + _areContextButtonsActive = value; + OnPropertyChanged(nameof(AreContextButtonsActive)); + } + } + } + + private int _contextMenuSelectedIndex; + + public int ContextMenuSelectedIndex + { + get => _contextMenuSelectedIndex; + set + { + if (_contextMenuSelectedIndex != value) + { + _contextMenuSelectedIndex = value; + OnPropertyChanged(nameof(ContextMenuSelectedIndex)); + } + } + } public const int NoSelectionIndex = -1; diff --git a/src/modules/launcher/PowerLauncher/ViewModel/ResultsViewModel.cs b/src/modules/launcher/PowerLauncher/ViewModel/ResultsViewModel.cs index cea1deabf8..eb3fe0ceb4 100644 --- a/src/modules/launcher/PowerLauncher/ViewModel/ResultsViewModel.cs +++ b/src/modules/launcher/PowerLauncher/ViewModel/ResultsViewModel.cs @@ -52,7 +52,20 @@ namespace PowerLauncher.ViewModel } } - public int SelectedIndex { get; set; } + private int _selectedIndex; + + public int SelectedIndex + { + get => _selectedIndex; + set + { + if (_selectedIndex != value) + { + _selectedIndex = value; + OnPropertyChanged(nameof(SelectedIndex)); + } + } + } private ResultViewModel _selectedItem; @@ -84,7 +97,20 @@ namespace PowerLauncher.ViewModel public Thickness Margin { get; set; } - public Visibility Visibility { get; set; } = Visibility.Hidden; + private Visibility _visibility = Visibility.Hidden; + + public Visibility Visibility + { + get => _visibility; + set + { + if (_visibility != value) + { + _visibility = value; + OnPropertyChanged(nameof(Visibility)); + } + } + } public ResultCollection Results { get; } diff --git a/src/modules/launcher/Wox.Infrastructure/UserSettings/PowerToysRunSettings.cs b/src/modules/launcher/Wox.Infrastructure/UserSettings/PowerToysRunSettings.cs index a0b4a959f8..3aca468577 100644 --- a/src/modules/launcher/Wox.Infrastructure/UserSettings/PowerToysRunSettings.cs +++ b/src/modules/launcher/Wox.Infrastructure/UserSettings/PowerToysRunSettings.cs @@ -38,7 +38,7 @@ namespace Wox.Infrastructure.UserSettings { _previousHotkey = _hotkey; _hotkey = value; - OnPropertyChanged(); + OnPropertyChanged(nameof(Hotkey)); } } } @@ -115,12 +115,25 @@ namespace Wox.Infrastructure.UserSettings if (_maxResultsToShow != value) { _maxResultsToShow = value; - OnPropertyChanged(); + OnPropertyChanged(nameof(MaxResultsToShow)); } } } - public int ActivateTimes { get; set; } + private int _activeTimes; + + public int ActivateTimes + { + get => _activeTimes; + set + { + if (_activeTimes != value) + { + _activeTimes = value; + OnPropertyChanged(nameof(ActivateTimes)); + } + } + } // Order defaults to 0 or -1, so 1 will let this property appear last [JsonProperty(Order = 1)] diff --git a/src/modules/launcher/Wox.Plugin/FodyWeavers.xml b/src/modules/launcher/Wox.Plugin/FodyWeavers.xml deleted file mode 100644 index 4e68ed1a8b..0000000000 --- a/src/modules/launcher/Wox.Plugin/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/modules/launcher/Wox.Plugin/FodyWeavers.xsd b/src/modules/launcher/Wox.Plugin/FodyWeavers.xsd deleted file mode 100644 index 69dbe488ce..0000000000 --- a/src/modules/launcher/Wox.Plugin/FodyWeavers.xsd +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - Used to control if the On_PropertyName_Changed feature is enabled. - - - - - Used to control if the Dependent properties feature is enabled. - - - - - Used to control if the IsChanged property feature is enabled. - - - - - Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form. - - - - - Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project. - - - - - Used to control if equality checks should use the Equals method resolved from the base class. - - - - - Used to control if equality checks should use the static Equals method resolved from the base class. - - - - - Used to turn off build warnings from this weaver. - - - - - Used to turn off build warnings about mismatched On_PropertyName_Changed methods. - - - - - - - - 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. - - - - - A comma-separated list of error codes that can be safely ignored in assembly verification. - - - - - 'false' to turn off automatic generation of the XML Schema file. - - - - - \ No newline at end of file diff --git a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj index acbc0b2442..cf336d10d1 100644 --- a/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj +++ b/src/modules/launcher/Wox.Plugin/Wox.Plugin.csproj @@ -71,10 +71,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - all @@ -83,9 +79,6 @@ - - all -