Example #1
0
 /// <summary>
 /// Generate a new command given delegates.  If you use OnUndo you must also provide a OnRedo.
 /// </summary>
 /// <param name="OnDo">The action to perform</param>
 /// <param name="OnUndo">The inverse of the action to perform</param>
 /// <param name="OnRedo">The inverse of the inverse of the action to perform</param>
 /// <returns>A command with this behaviour.</returns>
 public static XTMFCommand CreateCommand(string name, XTMFCommandMethod OnDo, XTMFCommandMethod OnUndo = null, XTMFCommandMethod OnRedo = null)
 {
     if (OnDo == null)
     {
         throw new ArgumentNullException(nameof(OnDo));
     }
     if ((OnUndo == null) != (OnRedo == null))
     {
         throw new ArgumentException("Both OnUndo and OnRedo must be null or both have delegates.");
     }
     return(new DelegateCommand(name, OnDo, OnUndo, OnRedo));
 }
Example #2
0
 /// <summary>
 /// Generate a new command given delegates.  If you use OnUndo you must also provide a OnRedo.
 /// </summary>
 /// <param name="OnDo">The action to perform</param>
 /// <param name="OnUndo">The inverse of the action to perform</param>
 /// <param name="OnRedo">The inverse of the inverse of the action to perform</param>
 /// <returns>A command with this behaviour.</returns>
 public static XTMFCommand CreateCommand(XTMFCommandMethod OnDo, XTMFCommandMethod OnUndo = null, XTMFCommandMethod OnRedo = null)
 {
     if ( OnDo == null )
     {
         throw new ArgumentNullException( "OnDo" );
     }
     if ( ( OnUndo == null ) != ( OnRedo == null ) )
     {
         throw new ArgumentException( "Both OnUndo and OnRedo must be null or both have delegates." );
     }
     return new DelegateCommand( OnDo, OnUndo, OnRedo );
 }
Example #3
0
 public DelegateCommand(string name, XTMFCommandMethod onDo, XTMFCommandMethod onUndo = null, XTMFCommandMethod onRedo = null) : base(name)
 {
     _OnDo   = onDo;
     _OnUndo = onUndo;
     _OnRedo = onRedo;
 }
Example #4
0
 public DelegateCommand(XTMFCommandMethod onDo, XTMFCommandMethod onUndo = null, XTMFCommandMethod onRedo = null)
 {
     OnDo   = onDo;
     OnUndo = onUndo;
     OnRedo = onRedo;
 }
Example #5
0
 public DelegateCommand(XTMFCommandMethod onDo, XTMFCommandMethod onUndo = null, XTMFCommandMethod onRedo = null)
 {
     OnDo = onDo;
     OnUndo = onUndo;
     OnRedo = onRedo;
 }