Код: Выделить всё
public class test : NotifiyingJsonSettings, IVersionable
{
private System.Version version = new Version(1, 0, 0, 0);
[EnforcedVersion("1.0.0.0")]
public System.Version Version
{
get => version;
set
{
version = value;
OnPropertyChanged(nameof(Version));
Save();
}
}
private string fileName = $"{AppContext.BaseDirectory}config.json";
public override string FileName
{
get => fileName;
set
{
if (fileName != value)
{
fileName = value;
OnPropertyChanged(nameof(FileName));
Save();
}
}
}
private string test;
public string Test
{
get => test;
set
{
test = value;
OnPropertyChanged(nameof(Test));
Save();
}
}
private bool test2;
public bool Test2
{
get => test2;
set
{
test2 = value;
OnPropertyChanged(nameof(Test2));
Save();
}
}
}
Код: Выделить всё
[AutoSave]
public class AppConfig : NotifiyingJsonSettings, IVersionable
{
[EnforcedVersion("1.0.0.0")]
public Version Version { get; set; } = new Version(1, 0, 0, 0);
public override string FileName { get; set; } = $"{AppContext.BaseDirectory}config.json";
public virtual string Test { get; set; }
public virtual bool Test2 { get; set; }
}
Код: Выделить всё
public partial class AppConfig : Nucs.JsonSettings.Examples.NotifiyingJsonSettings, Nucs.JsonSettings.Modulation.IVersionable
{
private System.Version version = new Version(1, 0, 0, 0);
[EnforcedVersion("1.0.0.0")]
public System.Version Version
{
get => version;
set
{
if (version != value)
{
version = value;
OnPropertyChanged();
Save();
}
}
}
private string fileName = $"{AppContext.BaseDirectory}config.json";
public override string FileName
{
get => fileName;
set
{
if (fileName != value)
{
fileName = value;
OnPropertyChanged();
Save();
}
}
}
private string test;
public string Test
{
get => test;
set
{
if (test != value)
{
test = value;
OnPropertyChanged();
Save();
}
}
}
private bool test2;
public bool Test2
{
get => test2;
set
{
if (test2 != value)
{
test2 = value;
OnPropertyChanged();
Save();
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... s-not-work