From d57a387ebece6685085c5fe9f666f2678643629b Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Mon, 18 Mar 2024 03:25:18 +0200 Subject: [PATCH] Remove Fody since it's a bit overkill for a single property --- Gress/FodyWeavers.xml | 4 --- Gress/FodyWeavers.xsd | 74 -------------------------------------- Gress/Gress.csproj | 1 - Gress/ProgressContainer.cs | 14 +++++++- 4 files changed, 13 insertions(+), 80 deletions(-) delete mode 100644 Gress/FodyWeavers.xml delete mode 100644 Gress/FodyWeavers.xsd diff --git a/Gress/FodyWeavers.xml b/Gress/FodyWeavers.xml deleted file mode 100644 index 4e68ed1..0000000 --- a/Gress/FodyWeavers.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Gress/FodyWeavers.xsd b/Gress/FodyWeavers.xsd deleted file mode 100644 index 69dbe48..0000000 --- a/Gress/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/Gress/Gress.csproj b/Gress/Gress.csproj index 5bcf238..21eb52f 100644 --- a/Gress/Gress.csproj +++ b/Gress/Gress.csproj @@ -24,7 +24,6 @@ - \ No newline at end of file diff --git a/Gress/ProgressContainer.cs b/Gress/ProgressContainer.cs index 246ec48..1c2fb4d 100644 --- a/Gress/ProgressContainer.cs +++ b/Gress/ProgressContainer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; @@ -27,7 +28,18 @@ public ProgressContainer() /// If this property is accessed before any progress has been reported, /// it will evaluate to the initial value provided by the constructor. /// - public T Current { get; private set; } = initial; + public T Current + { + get => initial; + private set + { + if (EqualityComparer.Default.Equals(value, initial)) + return; + + initial = value; + OnPropertyChanged(); + } + } /// public void Report(T value) => Current = value;