MarkEvent() public method

Marks an event. This method also serves as an extensibility point for custom events.
public MarkEvent ( BaseEvent anEvent ) : void
anEvent BaseEvent The event to be marked.
return void
Exemplo n.º 1
0
 /// <summary>
 /// Marks an element addition event.
 /// </summary>
 /// <typeparam name="T">The generic type parameter of the collection.</typeparam>
 /// <param name="mementor">The mementor object.</param>
 /// <param name="collection">The collection object.</param>
 /// <param name="element">The element being added.</param>
 public static void ElementAdd <T>(this Mementor mementor,
                                   IList <T> collection, T element)
 {
     if (mementor.IsTrackingEnabled)
     {
         mementor.MarkEvent(new ElementAdditionEvent <T>(collection, element));
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Marks an element index change event.
 /// </summary>
 /// <typeparam name="T">The generic type parameter of the collection.</typeparam>
 /// <param name="mementor">The mementor object.</param>
 /// <param name="collection">The collection object.</param>
 /// <param name="element">The element whose index is being changed</param>
 /// <param name="elementIndex">The index of the element being removed. If not supplied, will retrieve via <see cref="IList{T}.IndexOf"/>.</param>
 public static void ElementIndexChange <T>(this Mementor mementor,
                                           IList <T> collection, T element, int?elementIndex = null)
 {
     if (mementor.IsTrackingEnabled)
     {
         mementor.MarkEvent(new ElementIndexChangeEvent <T>(collection, element, elementIndex));
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Marks a property change event.
 /// </summary>
 /// <param name="mementor">The mementor object.</param>
 /// <param name="target">The target object.</param>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="previousValue">The value to be restored to when undo.
 /// If not supplied, will be retrieved directly from the <paramref name="target"/>.</param>
 public static void PropertyChange(this Mementor mementor,
                                   object target, string propertyName, object previousValue = null)
 {
     if (mementor.IsTrackingEnabled)
     {
         mementor.MarkEvent(new PropertyChangeEvent(target, propertyName, previousValue));
     }
 }