You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
992 B
29 lines
992 B
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace YOUserbase {
|
|
public class Group : INotifyPropertyChanged {
|
|
int id;
|
|
string name;
|
|
string details;
|
|
public int Id { get => id; set => ChangeValue(ref id, value); }
|
|
public string Name { get => name; set => ChangeValue(ref name, value); }
|
|
public string Details { get => details; set => ChangeValue(ref details, value); }
|
|
|
|
private static int index = 0;
|
|
|
|
public Group() {
|
|
Id = ++index;
|
|
}
|
|
|
|
// Wrpper to change vaulue and notify if it changed
|
|
private void ChangeValue<T>(ref T field, T value, [CallerMemberName] string propertyName = "") {
|
|
if(!value.Equals(field)) {
|
|
field = value;
|
|
if(PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
}
|
|
} |