Fixed bug in file loader.
Implemented ResetModified.
This commit is contained in:
@@ -59,12 +59,12 @@ namespace UCalc.Data
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue,
|
||||
JsonSerializer serializer)
|
||||
{
|
||||
return existingValue ?? string.Empty;
|
||||
return reader.Value ?? "";
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
writer.WriteValue(value ?? string.Empty);
|
||||
writer.WriteValue(value ?? "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -248,7 +248,9 @@ namespace UCalc.Models
|
||||
|
||||
public void ResetModified()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
using var validator = BeginValidation();
|
||||
|
||||
Root.ResetModified();
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
@@ -81,6 +81,11 @@ namespace UCalc.Models
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
public virtual void ResetModified()
|
||||
{
|
||||
Modified = false;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class ValueProperty<T> : Property
|
||||
@@ -244,6 +249,14 @@ namespace UCalc.Models
|
||||
|
||||
base.OnPropertyChanged(propertyName);
|
||||
}
|
||||
|
||||
public override void ResetModified()
|
||||
{
|
||||
foreach (var property in _properties)
|
||||
{
|
||||
property.ResetModified();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class MultiProperty<T> : Property, IReadOnlyList<T>, INotifyCollectionChanged where T : Property
|
||||
@@ -342,6 +355,14 @@ namespace UCalc.Models
|
||||
base.OnPropertyChanged(propertyName);
|
||||
}
|
||||
|
||||
public override void ResetModified()
|
||||
{
|
||||
foreach (var property in _properties)
|
||||
{
|
||||
property.ResetModified();
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator<T> GetEnumerator()
|
||||
{
|
||||
return _properties.GetEnumerator();
|
||||
|
||||
Reference in New Issue
Block a user