コード例 #1
0
ファイル: RxCommand.cs プロジェクト: josephdwyer/Craft
 /// <summary>
 /// Executes the first command and then when it completes executes the second command.  The second command
 /// expects TInput as an argument, and the returned command also expects TInput when executed.
 /// </summary>
 /// <param name="first">The command to execute first</param>
 /// <param name="second">The command to execute second</param>
 /// <returns>The new command that executes both commands in turn.</returns>
 public static IRxCommand <TInput> Combine <TInput>(this IRxCommand first, IRxCommand <TInput> second)
 {
     return(RxCommand.Create <TInput>(async x =>
     {
         await first.InvokeAsync();
         await second.InvokeAsync(x);
     }));
 }
コード例 #2
0
ファイル: RxCommand.cs プロジェクト: josephdwyer/Craft
 /// <summary>
 /// Executes the first command and then when it completes executes the second command.
 /// </summary>
 /// <param name="first">The command to execute first</param>
 /// <param name="second">The command to execute second</param>
 /// <returns>The new command that executes both commands in turn.</returns>
 public static IRxCommand Combine(this IRxCommand first, IRxCommand second)
 {
     return(RxCommand.Create(async() =>
     {
         await first.InvokeAsync();
         await second.InvokeAsync();
     }));
 }
コード例 #3
0
ファイル: RxCommand.cs プロジェクト: josephdwyer/Craft
 /// <summary>
 /// Converts an IRxFunction&lt;TOutput&gt; into an IRxCommand.  This can be useful with methods such as
 /// Combine which expect particular types of commands that may not fit the command you have in order to
 /// get the behavor you otherwise expect.  The value returned from the function is simply discarded.
 /// </summary>
 public static IRxCommand <TInput> AsCommand <TInput, TOutput>(this IRxFunction <TInput, TOutput> function)
 {
     return(RxCommand.Create <TInput>(x => function.InvokeAsync(x)));
 }
コード例 #4
0
ファイル: RxCommand.cs プロジェクト: josephdwyer/Craft
 /// <summary>
 /// Converts an IRxFunction&lt;TOutput&gt; into an IRxCommand.  This can be useful with methods such as
 /// Combine which expect particular types of commands that may not fit the command you have in order to
 /// get the behavor you otherwise expect.  The value returned from the function is simply discarded.
 /// </summary>
 public static IRxCommand AsCommand <TOutput>(this IRxFunction <TOutput> function)
 {
     return(RxCommand.Create(() => function.InvokeAsync()));
 }
コード例 #5
0
ファイル: RxCommand.cs プロジェクト: josephdwyer/Craft
 /// <summary>
 /// Converts an unparameterized command into a command parameterized by Unit.  This can be useful with methods such
 /// as Combine which expect particular types of commands that may not fit the command you have in order to
 /// get the behavor you otherwise expect.
 /// </summary>
 public static IRxCommand <Unit> AsParameterized(this IRxCommand command)
 {
     return(RxCommand.Create <Unit>(_ => command.InvokeAsync()));
 }