Implement the INotifyPropertyChanged interface

This commit is contained in:
Manuel Thalmann 2024-03-21 23:15:24 +01:00
parent 12a7fe3c17
commit 80a8817143
2 changed files with 22 additions and 4 deletions

Binary file not shown.

View file

@ -2,13 +2,14 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using DT2; using DT2;
namespace DT3 { namespace DT3 {
public class UrlTesterModel /* TO BE DONE */ { public class UrlTesterModel : INotifyPropertyChanged {
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
int size; int size;
@ -31,17 +32,34 @@ namespace DT3 {
public int Size { public int Size {
get { return size; } get { return size; }
set /* TO BE DONE */ set
{
NotifyPropertyChanged();
size = value;
}
} }
public int Time { public int Time {
get { return time; } get { return time; }
set /* TO BE DONE */ set
{
NotifyPropertyChanged();
time = value;
}
} }
public string Url { public string Url {
get { return url; } get { return url; }
set /* TO BE DONE */ set
{
NotifyPropertyChanged();
url = value;
}
}
protected void NotifyPropertyChanged([CallerMemberName] string memberName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(memberName));
} }
} }