Beispiel #1
0
 /// <summary>
 /// <see cref="IActionSequence.Append{T1,T2}(Action{T1,T2},T1,T2)">Appends</see> the action to this <see cref="IActionSequence"/> if possible,
 /// or executes it immediately.
 /// </summary>
 /// <param name="s">This <see cref="IActionSequence"/>. Can be null.</param>
 /// <param name="action">The action to execute. Can be null: in such case nothing is done.</param>
 /// <param name="p1">First action parameter.</param>
 /// <param name="p2">Second action parameter.</param>
 static public void NowOrLater <T1, T2>(this IActionSequence s, Action <T1, T2> action, T1 p1, T2 p2)
 {
     if (action != null)
     {
         if (s != null && !s.ReadOnly)
         {
             s.Append(action, p1, p2);
         }
         else
         {
             action(p1, p2);
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// <see cref="IActionSequence.Append(Action)">Appends</see> the action to this <see cref="IActionSequence"/> if possible, or executes it immediately.
 /// </summary>
 /// <param name="s">This <see cref="IActionSequence"/>. Can be null.</param>
 /// <param name="action">The action to execute. Can be null: in such case nothing is done.</param>
 static public void NowOrLater(this IActionSequence s, Action action)
 {
     if (action != null)
     {
         if (s != null && !s.ReadOnly)
         {
             s.Append(action);
         }
         else
         {
             action();
         }
     }
 }
Beispiel #3
0
 /// <summary>
 /// <see cref="IActionSequence.Append{T}(Action{T},T)">Appends</see> the action to this <see cref="IActionSequence"/> if possible, or executes it immediately.
 /// </summary>
 /// <param name="s">This <see cref="IActionSequence"/>. Can be null.</param>
 /// <param name="p">Parameter of the action.</param>
 /// <param name="action">The action to execute. Can be null: in such case nothing is done.</param>
 static public void NowOrLater <T>(this IActionSequence s, Action <T> action, T p)
 {
     if (action != null)
     {
         if (s != null && !s.ReadOnly)
         {
             s.Append(action, p);
         }
         else
         {
             action(p);
         }
     }
 }
Beispiel #4
0
 /// <summary>
 /// <see cref="IActionSequence.Append{T}(EventHandler{T},object,T)">Appends</see> an event raising to this <see cref="IActionSequence"/> if possible, or executes it immediately.
 /// </summary>
 /// <typeparam name="T">Must be a class that inherits from <see cref="EventArgs"/>.</typeparam>
 /// <param name="s">This <see cref="IActionSequence"/>. Can be null.</param>
 /// <param name="e">The <see cref="EventHandler{T}"/> delegate.</param>
 /// <param name="source">Source of the event.</param>
 /// <param name="eventArgs">Event argument.</param>
 static public void NowOrLater <T>(this IActionSequence s, EventHandler <T> e, object source, T eventArgs) where T : EventArgs
 {
     if (e != null)
     {
         if (s != null && !s.ReadOnly)
         {
             s.Append(e, source, eventArgs);
         }
         else
         {
             e(source, eventArgs);
         }
     }
 }