Last active
February 11, 2018 08:27
-
-
Save kamronbatman/14dbc1aaed5193bb47fe9062f4fbcf2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NewItemThing : Item, INotifyPropertyChanged, IQueuePersistable | |
{ | |
public static event EventHandler<PropertyChangedEventArgs<String>> StringPropertyChanged; | |
private static void StringPropertyChanged(object obj, string propertyName, string value) | |
{ | |
if (StringPropertyChanged != null) | |
{ | |
StringPropertyChanged(obj, new PropertyChangedEventArgs_String(propertyName, value)); | |
} | |
} | |
private string name; | |
public string Name | |
{ | |
get | |
{ | |
return name; | |
} | |
set | |
{ | |
if (value != name) | |
{ | |
name = value; | |
NewItemThing.StringPropertyChanged(this, "Name", value); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
public void Register(ISerial serial) | |
{ | |
QueueList.Add(serial, this); | |
} | |
private void HandleStringPropertyChanges(object sender, PropertyChangedEventArgs_String e) | |
{ | |
... | |
IQueuePersistable persistable = e.persistable; | |
QueueTransaction t; | |
QueueList.TryGetValue(persistable.Serial, out t); | |
t.Queue(persistable, e.propertyName, e.value); | |
... | |
} | |
NewItemThing.StringPropertyChanged += HandleStringPropertyChanges | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
NewItemThing item = new NewItemThing(); | |
using (t = new QueueTransaction()) | |
{ | |
t.Register(item); | |
item.Name = "Kamron"; | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment