diff --git a/nuget/Caliburn.Light.nuspec b/nuget/Caliburn.Light.nuspec index d4dd092..f7f4e8d 100644 --- a/nuget/Caliburn.Light.nuspec +++ b/nuget/Caliburn.Light.nuspec @@ -3,7 +3,7 @@ Caliburn.Light Caliburn.Light - 1.1.0 + 1.2.0 Thomas Ibel Fork of Caliburn.Micro that integrates some ideas of Prism and MVVMLight including a modular approach and weak events. en-US @@ -11,7 +11,7 @@ https://github.com/tibel/Caliburn.Light https://github.com/tibel/Caliburn.Light/raw/master/logo.png false - Add support for special values. + Add parameter support to DelegateCommand. Copyright Thomas Ibel 2014 Caliburn MVVM WPF WP8 WinRT Screen Coroutine EventAggregator Behavior Model-View-ViewModel Presentation UI ViewModel Phone IoC Validation Command diff --git a/src/Caliburn.Core/Action/DelegateCommand.cs b/src/Caliburn.Core/Action/DelegateCommand.cs index 8fa0e4c..b6d5b01 100644 --- a/src/Caliburn.Core/Action/DelegateCommand.cs +++ b/src/Caliburn.Core/Action/DelegateCommand.cs @@ -12,6 +12,7 @@ namespace Caliburn.Light /// /// Wraps a ViewModel method (with guard) in an . /// + /// When using a property as guard then is raised automatically. public sealed class DelegateCommand : ICommand { private readonly object _target; @@ -31,6 +32,17 @@ public static DelegateCommand Create(Action action) return CreateInternal(action); } + /// + /// Creates a new from the specified . + /// + /// The type of the parameter. + /// The action. + /// The new . + public static DelegateCommand Create(Action action) + { + return CreateInternal(action); + } + /// /// Creates a new from the specified . /// @@ -42,14 +54,24 @@ public static DelegateCommand Create(Func action) return CreateInternal(action); } + /// + /// Creates a new from the specified . + /// + /// The type of the parameter. + /// The type of the result. + /// The action. + /// The new . + public static DelegateCommand Create(Func action) + { + return CreateInternal(action); + } + private static DelegateCommand CreateInternal(Delegate action) { if (action == null) throw new ArgumentNullException("action"); if (action.Target == null) throw new ArgumentException("Method cannot be static.", "action"); - if (action.GetMethodInfo().IsClosure()) - throw new ArgumentException("A closure cannot be used.", "action"); return new DelegateCommand(action.Target, action.GetMethodInfo()); } diff --git a/src/GlobalAssemblyInfo.cs b/src/GlobalAssemblyInfo.cs index 4a192bd..d8b42d1 100644 --- a/src/GlobalAssemblyInfo.cs +++ b/src/GlobalAssemblyInfo.cs @@ -14,5 +14,5 @@ [assembly: CLSCompliant(true)] #endif -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: AssemblyVersion("1.2.0.0")] +[assembly: AssemblyFileVersion("1.2.0.0")]