using System.ComponentModel;
namespace Core.Common.Utils.Events
{
///
/// EventArgs for a collection that include the item and the action.
///
/// Note: for performance reasons we use fields here instead of properties.
///
public class NotifyCollectionChangeEventArgs : CancelEventArgs
{
///
/// Indicate what operation took place such as add, remove etc...
///
public NotifyCollectionChangeAction Action;
///
/// When inserting, this is the position where the item is inserted.
///
public int Index;
///
/// Previous index (if changed). TODO: remove it. This is the index at which the insert was intent
///
public int OldIndex;
public NotifyCollectionChangeEventArgs(NotifyCollectionChangeAction action, object item, int index, int oldIndex)
{
Action = action;
Item = item;
Index = index;
OldIndex = oldIndex;
}
public NotifyCollectionChangeEventArgs() {}
///
/// The item added, removed or replaced. On replace the new item is given
///
public virtual object Item { get; set; }
///
/// Item that is replaced. (only filled out on replace)
///
public virtual object OldItem { get; set; }
}
}