- add GBaseEntryChanged event

pull/26/head
Simon Gockner 6 years ago
parent 9e80dd4796
commit e68834b319
  1. 23
      GBase.Api/GBaseEntryChangedEventArgs.cs
  2. 16
      GBase.Api/INotifyGBaseEntryChanged.cs
  3. 26
      GBase.Api/NotifyGBaseEntryChanged.cs

@ -0,0 +1,23 @@
// Author: Gockner, Simon
// Created: 2020-03-06
// Copyright(c) 2020 SimonG. All Rights Reserved.
using System;
namespace GBase.Api
{
/// <summary>
/// <see cref="EventArgs"/> for the <see cref="INotifyGBaseEntryChanged"/> event
/// </summary>
public class GBaseEntryChangedEventArgs : EventArgs
{
public GBaseEntryChangedEventArgs(string propertyName, object value)
{
PropertyName = propertyName;
Value = value;
}
public string PropertyName { get; }
public object Value { get; }
}
}

@ -0,0 +1,16 @@
// Author: Gockner, Simon
// Created: 2020-03-06
// Copyright(c) 2020 SimonG. All Rights Reserved.
using System;
namespace GBase.Api
{
/// <summary>
/// Notify the GBase that an entry has changed
/// </summary>
public interface INotifyGBaseEntryChanged
{
static event EventHandler<GBaseEntryChangedEventArgs> GBaseEntryChanged;
}
}

@ -0,0 +1,26 @@
// Author: Gockner, Simon
// Created: 2020-03-06
// Copyright(c) 2020 SimonG. All Rights Reserved.
using System;
namespace GBase.Api
{
/// <summary>
/// Notify the GBase that an entry has changed
/// </summary>
public abstract class NotifyGBaseEntryChanged : INotifyGBaseEntryChanged
{
public event EventHandler<GBaseEntryChangedEventArgs> GBaseEntryChanged;
protected void RaiseGBaseEntryChanged(object sender, string propertyName, object value)
{
GBaseEntryChanged?.BeginInvoke(sender, new GBaseEntryChangedEventArgs(propertyName, value), GBaseEntryChangedCallback, null);
}
private void GBaseEntryChangedCallback(IAsyncResult asyncResult)
{
GBaseEntryChanged?.EndInvoke(asyncResult); //TestMe: Does this work? Or is there something to be done with the asyncResult
}
}
}
Loading…
Cancel
Save