A database based on .net
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.

39 lines
1.5 KiB

// 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 //TODO: Rename to GBaseValueChanged or EntryUpdated?
{
/// <summary>
/// Notify the GBase that an entry has changed
/// </summary>
public event EventHandler<GBaseEntryChangedEventArgs> GBaseEntryChanged;
/// <summary>
/// Raise the <see cref="GBaseEntryChanged"/> event
/// </summary>
/// <param name="entry">The entry (sender)</param>
/// <param name="columnName">The name of the IGBaseColumn</param>
/// <param name="value">The new value</param>
protected void RaiseGBaseEntryChanged(object entry, string columnName, object value)
{
GBaseEntryChanged?.BeginInvoke(entry, new GBaseEntryChangedEventArgs(columnName, value), GBaseEntryChangedCallback, null);
}
/// <summary>
/// Callback for the <see cref="GBaseEntryChanged"/> event
/// </summary>
/// <param name="asyncResult">The <see cref="IAsyncResult"/></param>
private void GBaseEntryChangedCallback(IAsyncResult asyncResult)
{
GBaseEntryChanged?.EndInvoke(asyncResult); //TestMe: Does this work? Or is there something to be done with the asyncResult
}
}
}