Skip to content

Commit 52b73ad

Browse files
Merge pull request #1 from JasonCheungDev/modoptionjson-property-changed
ModOptionJson implements INotifyPropertyChanegd
2 parents aae209f + adfe3ff commit 52b73ad

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

xivModdingFramework/Mods/DataContainers/ModPackJson.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
using System.Collections.Generic;
18+
using System.ComponentModel;
1819
using System.Security.Cryptography;
1920
using System.Text;
2021

@@ -122,7 +123,7 @@ public class ModGroupJson
122123
public List<ModOptionJson> OptionList { get; set; }
123124
}
124125

125-
public class ModOptionJson
126+
public class ModOptionJson : INotifyPropertyChanged
126127
{
127128
/// <summary>
128129
/// The name of the option
@@ -157,7 +158,32 @@ public class ModOptionJson
157158
/// <summary>
158159
/// The status of the radio or checkbox
159160
/// </summary>
160-
public bool IsChecked { get; set; }
161+
private bool isChecked;
162+
public bool IsChecked {
163+
get {
164+
return isChecked;
165+
}
166+
set {
167+
isChecked = value;
168+
NotifyPropertyChanged("IsChecked");
169+
}
170+
}
171+
172+
/// <summary>
173+
/// Implementation of INotifyPropertyChanged (to update UI)
174+
/// </summary>
175+
public event PropertyChangedEventHandler PropertyChanged;
176+
177+
/// <summary>
178+
/// Helper to raise the property changed event
179+
/// </summary>
180+
/// <param name="propName">Name of the property that changed</param>
181+
private void NotifyPropertyChanged(string propName)
182+
{
183+
if (PropertyChanged != null)
184+
PropertyChanged(this, new PropertyChangedEventArgs(propName));
185+
}
186+
161187
}
162188

163189
public class ModsJson

0 commit comments

Comments
 (0)