// Author: Gockner, Simon // Created: 2020-03-06 // Copyright(c) 2020 SimonG. All Rights Reserved. using System; namespace GBase.Api { /// /// Notify the GBase that an entry has changed /// public abstract class NotifyGBaseEntryChanged : INotifyGBaseEntryChanged //TODO: Rename to GBaseValueChanged or EntryUpdated? { /// /// Notify the GBase that an entry has changed /// public event EventHandler GBaseEntryChanged; /// /// Raise the event /// /// The entry (sender) /// The name of the IGBaseColumn /// The new value protected void RaiseGBaseEntryChanged(object entry, string columnName, object value) { GBaseEntryChanged?.BeginInvoke(entry, new GBaseEntryChangedEventArgs(columnName, value), GBaseEntryChangedCallback, null); } /// /// Raise the GBaseEntry removed ( event without args) /// /// The entry (sender) protected void RaiseGBaseEntryRemoved(object entry) { GBaseEntryChanged?.BeginInvoke(entry, null, GBaseEntryChangedCallback, null); } /// /// Callback for the event /// /// The private void GBaseEntryChangedCallback(IAsyncResult asyncResult) { GBaseEntryChanged?.EndInvoke(asyncResult); //TestMe: Does this work? Or is there something to be done with the asyncResult } } }