protected void setScriptCommand(IScriptCommand value) { _scriptCommand = value; _command = new SimpleCommand() { CanExecuteDelegate = (p) => !(ScriptCommand is NullScriptCommand) && ScriptCommand.CanExecute(ParameterDicConverter.Convert(p)), ExecuteDelegate = (p) => ScriptRunner.RunScriptAsync(ParameterDicConverter.Convert(p), ScriptCommand) }; }
public ExplorerCommandManager(IExplorerViewModel evm, params ISupportCommandManager[] cMs) : this(evm, cMs.Select(cm => cm.Commands).ToArray()) { //Workaround: Add all properties to sub-commandManager, //e.g. Add Explorer to FileList.Commands.ParameterDicConverter var paramDic = ParameterDicConverter.Convert(null); foreach (var iscm in cMs) { iscm.Commands.ParameterDicConverter.AddAdditionalParameters(paramDic); } }
private CommandBinding getCommandBiniding() { return(new CommandBinding(UICommandKey, (ExecutedRoutedEventHandler) delegate(object sender, ExecutedRoutedEventArgs e) { var pd = ParameterDicConverter.Convert(e.Parameter, "Executed", sender, e); Command.Execute(pd); e.Handled = true; }, (CanExecuteRoutedEventHandler) delegate(object sender, CanExecuteRoutedEventArgs e) { var pd = ParameterDicConverter.Convert(e.Parameter, "Executed", sender, e); e.CanExecute = Command.CanExecute(pd); })); }