From dc79350e1b570cba0a199219e85cc5e26b74f077 Mon Sep 17 00:00:00 2001 From: David Vreony Date: Fri, 7 Jun 2024 23:33:23 +0100 Subject: [PATCH] add support for input, output args on commands --- src/Vetuviem.Core/CommandBinding.cs | 61 +++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/src/Vetuviem.Core/CommandBinding.cs b/src/Vetuviem.Core/CommandBinding.cs index 5b30a0e..e3c2d9d 100644 --- a/src/Vetuviem.Core/CommandBinding.cs +++ b/src/Vetuviem.Core/CommandBinding.cs @@ -15,12 +15,9 @@ namespace Vetuviem.Core /// Represents a command binding between a control and a viewmodel. /// /// The type for the viewmodel. - public sealed class CommandBinding : ICommandBinding + public class CommandBinding : CommandBinding where TViewModel : class { - private readonly Expression?>> _viewModelBinding; - private readonly string? _toEvent; - /// /// Initializes a new instance of the class. /// @@ -29,6 +26,62 @@ public sealed class CommandBinding : ICommandBinding?>> viewModelBinding, string? toEvent = null) + : base( + viewModelBinding, + toEvent) + { + } + } + + /// + /// Represents a command binding between a control and a viewmodel. + /// + /// The type for the viewmodel. + /// + /// The type of the values that are the result of command execution. + /// + public class CommandBinding : CommandBinding + where TViewModel : class + { + /// + /// Initializes a new instance of the class. + /// + /// Expression for the View Model binding. + /// If specified, bind to the specific event instead of the default. + public CommandBinding( + Expression?>> viewModelBinding, + string? toEvent = null) + : base( + viewModelBinding, + toEvent) + { + } + } + + /// + /// Represents a command binding between a control and a viewmodel. + /// + /// The type for the viewmodel. + /// + /// The type of parameter values passed in during command execution. + /// + /// + /// The type of the values that are the result of command execution. + /// + public class CommandBinding : ICommandBinding + where TViewModel : class + { + private readonly Expression?>> _viewModelBinding; + private readonly string? _toEvent; + + /// + /// Initializes a new instance of the class. + /// + /// Expression for the View Model binding. + /// If specified, bind to the specific event instead of the default. + public CommandBinding( + Expression?>> viewModelBinding, + string? toEvent = null) { _viewModelBinding = viewModelBinding; _toEvent = toEvent;