Example #1
0
 /// <summary>
 /// Returns the storage but if its null it initializes a new instance
 /// of the command, stores it in storage and returns it.
 /// </summary>
 /// <param name="storage">The backing storage of the command</param>
 /// <param name="execute">The execute method</param>
 /// <param name="canExecute">The can execute method</param>
 /// <returns></returns>
 public static RelayCommandAsync <T> New(ref RelayCommandAsync <T> storage, Func <T, Task> execute, Func <T, bool> canExecute = null)
 {
     return(storage ?? (storage = new RelayCommandAsync <T>(execute, canExecute)));
 }
Example #2
0
 /// <summary>
 /// Returns the storage but if its null it initializes a new instance
 /// of the command, stores it in storage and returns it.
 /// </summary>
 /// <param name="storage">The backing storage of the command</param>
 /// <param name="canExecute">The can execute method</param>
 /// <param name="execute">The execute method</param>
 /// <returns></returns>
 public static RelayCommandAsync New(ref RelayCommandAsync storage, Func <bool> canExecute, Func <Task> execute)
 {
     return(storage ?? (storage = new RelayCommandAsync(execute, canExecute)));
 }