I'm trying to implement INotifyPropertyChanged, but I don't think I fully understand the concept when using it with Config.NET. What is it supposed to do? Is it supposed to update the UI when a configuration value changes?
I'm trying to implement it with Prism, but I'm sure I am missing something.
public interface IMyConfiguration : INotifyPropertyChanged
{
string Name { get; set; }
}
public class MainWindowViewModel : BindableBase
{
public ICommand TestClickButtonCommand { get; private set; }
public IMyConfiguration config;
private string title;
public string Title {
get => title;
set => SetProperty(ref title, value);
}
public MainWindowViewModel()
{
TestClickButtonCommand = new DelegateCommand(TestClickBtn);
Title = "Hi!";
config = new ConfigurationBuilder<IMyConfiguration>()
.UseJsonFile("AppSettingsTest.json")
.Build();
config.PropertyChanged += (sender, e) =>
{
Trace.WriteLine(e.PropertyName); // Log "Name" when button is clicked
};
}
private void TestClickBtn()
{
Trace.WriteLine("Button clicked...");
config.Name = "Hello World";
}
}
Now that "Name" is logged at the line "config.PropertyChanged += ()", what should I do? Is there a way to automatically update my UI with the updated Title property?
Hi,
I'm trying to implement INotifyPropertyChanged, but I don't think I fully understand the concept when using it with Config.NET. What is it supposed to do? Is it supposed to update the UI when a configuration value changes?
I'm trying to implement it with Prism, but I'm sure I am missing something.
Now that "Name" is logged at the line "config.PropertyChanged += ()", what should I do? Is there a way to automatically update my UI with the updated Title property?
I'm sure I'm missing something.
Thanks for help.