Example #1
0
 public EntityCommand(ExecuteDelegate execute, CanExecuteDelegate canExecute)
 {
     if (execute == null)
         throw new ArgumentNullException("execute");
     _CanExecuteDelegate = canExecute;
     _ExecuteDelegate = execute;
 }
Example #2
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="execute">Метод, обрабатывающий выполнение команды</param>
 /// <param name="beforeExecute">Метод, предваряющий выполнение команды</param>
 /// <param name="canExecute">Метод, определяющий, может ли быть выполнена команда</param>
 public CommandHandler(ExecuteDelegate execute, BeforeExecuteDelegate beforeExecute,
                       CanExecuteDelegate canExecute)
 {
     this.Execute       = execute;
     this.BeforeExecute = beforeExecute;
     this.CanExecute    = canExecute;
 }
        public static void GenerateExecutionModeCommands(SolutionEntityItem project, CanExecuteDelegate runCheckDelegate, CommandArrayInfo info)
        {
            CommandExecutionContext ctx = new CommandExecutionContext (project, runCheckDelegate);
            bool supportsParameterization = false;

            foreach (List<IExecutionMode> modes in GetExecutionModeCommands (ctx, false, true)) {
                foreach (IExecutionMode mode in modes) {
                    CommandInfo ci = info.Add (mode.Name, new CommandItem (ctx, mode));
                    if ((mode.ExecutionHandler is ParameterizedExecutionHandler) || ((mode is CustomExecutionMode) && ((CustomExecutionMode)mode).PromptForParameters)) {
                        // It will prompt parameters, so we need command to end with '..'.
                        // However, some commands may end with '...' already and we don't want to break
                        // already-translated strings by altering them
                        if (!ci.Text.EndsWith ("..."))
                            ci.Text += "...";
                        supportsParameterization = true;
                    } else {
                        // The parameters window will be shown if ctrl is pressed
                        ci.Description = GettextCatalog.GetString ("Run With: {0}", ci.Text);
                        if (SupportsParameterization (mode, ctx)) {
                            ci.Description += " - " + GettextCatalog.GetString ("Hold Control key to display the execution parameters dialog.");
                            supportsParameterization = true;
                        }
                    }
                }
                if (info.Count > 0)
                    info.AddSeparator ();
            }
            if (supportsParameterization) {
                info.AddSeparator ();
                info.Add (GettextCatalog.GetString ("Edit Custom Modes..."), new CommandItem (ctx, null));
            }
        }
Example #4
0
        public static void GenerateExecutionModeCommands(SolutionEntityItem project, CanExecuteDelegate runCheckDelegate, CommandArrayInfo info)
        {
            CommandExecutionContext ctx   = new CommandExecutionContext(project, runCheckDelegate);
            bool supportsParameterization = false;

            foreach (List <IExecutionMode> modes in GetExecutionModeCommands(ctx, false, true))
            {
                foreach (IExecutionMode mode in modes)
                {
                    CommandInfo ci = info.Add(mode.Name, new CommandItem(ctx, mode));
                    if ((mode.ExecutionHandler is ParameterizedExecutionHandler) || ((mode is CustomExecutionMode) && ((CustomExecutionMode)mode).PromptForParameters))
                    {
                        // It will prompt parameters, so we need command to end with '..'.
                        // However, some commands may end with '...' already and we don't want to break
                        // already-translated strings by altering them
                        if (!ci.Text.EndsWith("..."))
                        {
                            ci.Text += "...";
                        }
                        supportsParameterization = true;
                    }
                    else
                    {
                        // The parameters window will be shown if ctrl is pressed
                        ci.Description = GettextCatalog.GetString("Run With: {0}", ci.Text);
                        if (SupportsParameterization(mode, ctx))
                        {
                            ci.Description          += " - " + GettextCatalog.GetString("Hold Control key to display the execution parameters dialog.");
                            supportsParameterization = true;
                        }
                    }
                }
                if (info.Count > 0)
                {
                    info.AddSeparator();
                }
            }

            var targets = new List <ExecutionTarget> ();

            FlattenExecutionTargets(targets, project.GetExecutionTargets(IdeApp.Workspace.ActiveConfiguration));

            if (targets.Count > 1)
            {
                foreach (var t in targets)
                {
                    var         h  = new TargetedExecutionHandler(Runtime.ProcessService.DefaultExecutionHandler, t);
                    CommandInfo ci = info.Add(t.FullName, new CommandItem(ctx, new ExecutionMode(t.Id, t.FullName, h)));
                    ci.Description = GettextCatalog.GetString("Run With: {0}", ci.Text);
                }
                info.AddSeparator();
            }

            if (supportsParameterization)
            {
                info.AddSeparator();
                info.Add(GettextCatalog.GetString("Edit Custom Modes..."), new CommandItem(ctx, null));
            }
        }
Example #5
0
 public ReactiveCommand(Action execute = null, CanExecuteDelegate canExecute = null, PropertyChangedWatcher propertyWatcher = null)
     : this(delegate(object param) { if (execute != null)
                                     {
                                         execute();
                                     }
            }, canExecute, propertyWatcher)
 {
 }
Example #6
0
        /// <summary>
        /// コマンド登録
        /// </summary>
        /// <param name="cm">コマンドマネージャ</param>
        public static void Register(ICommandManager cm)
        {
            // 実行可否Delegate
            CanExecuteDelegate does_open_target_session = new CanExecuteDelegate(DoesOpenTargetSession);

            // 登録
            cm.Register(new ConnectProfileCommand(ConnectProfilePlugin.CMD_ID_MAIN, "Command.ConnectProfile", new ExecuteDelegate(MainWindow)));
            cm.Register(new ConnectProfileCommand(ConnectProfilePlugin.CMD_ID_ADDPROFILE, "Command.AddConnectProfile", new ExecuteDelegate(AddConnectProfile), does_open_target_session));
        }
        public static void Register(ICommandManager cm) {
            CanExecuteDelegate does_open_target_session = new CanExecuteDelegate(DoesOpenTargetSession);

            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.editrenderprofile", "Command.EditRenderProfile", new ExecuteDelegate(CmdEditRenderProfile), does_open_target_session));
            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.renametab", "Command.RenameTab", new ExecuteDelegate(CmdRenameTab), does_open_target_session));
            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.commentlog", "Command.CommentLog", new ExecuteDelegate(CmdCommentLog), does_open_target_session));
            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.changelog", "Command.ChangeLog", new ExecuteDelegate(CmdChangeLog), does_open_target_session));
            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.shellSchemeEditor", "Command.ShellSchemeEditor", new ExecuteDelegate(CmdShellSchemeEditor)));
        }
Example #8
0
 public EntityCommand(ExecuteDelegate execute, CanExecuteDelegate canExecute)
 {
     if (execute == null)
     {
         throw new ArgumentNullException("execute");
     }
     _CanExecuteDelegate = canExecute;
     _ExecuteDelegate    = execute;
 }
Example #9
0
        public CommandBindingWrapper(UIElement uiElement, CanExecuteDelegate canExecute, OnClickDelegate onClick)
        {
            var commandBinding = new CommandBinding();

            commandBinding.Command     = _command;
            commandBinding.CanExecute += (obj, args) => { args.CanExecute = canExecute(); };
            commandBinding.Executed   += (obj, args) => onClick();
            _commandBinding            = commandBinding;
            uiElement.CommandBindings.Add(_commandBinding);
        }
Example #10
0
        public static void Register(ICommandManager cm)
        {
            CanExecuteDelegate does_open_target_session = new CanExecuteDelegate(DoesOpenTargetSession);

            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.editrenderprofile", "Command.EditRenderProfile", new ExecuteDelegate(CmdEditRenderProfile), does_open_target_session));
            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.renametab", "Command.RenameTab", new ExecuteDelegate(CmdRenameTab), does_open_target_session));
            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.commentlog", "Command.CommentLog", new ExecuteDelegate(CmdCommentLog), does_open_target_session));
            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.changelog", "Command.ChangeLog", new ExecuteDelegate(CmdChangeLog), does_open_target_session));
            cm.Register(new TerminalUICommand("org.poderosa.terminalemulator.shellSchemeEditor", "Command.ShellSchemeEditor", new ExecuteDelegate(CmdShellSchemeEditor)));
        }
Example #11
0
 /// <summary>
 /// 确定此命令是否可在其当前状态下执行的方法。
 /// WPF 中触发 CanExecute 的条件:
 /// 1. 获取键盘焦点时
 /// 2. Execute 调用前
 /// 3. Execute 调用后。
 /// </summary>
 /// <param name="parameter"></param>
 /// <returns></returns>
 public virtual bool CanExecute(object parameter)
 {
     // 仅在第一次获取键盘焦点时,执行 CanExecuteDelegate
     if (IsFirstKeyboardFocus)
     {
         // 备注:使用关键字 async 返回的 Task 会自动执行
         IsCan = CanExecuteDelegate?.Invoke(parameter) ?? true;
         IsFirstKeyboardFocus = false;
     }
     return(Can());
 }
Example #12
0
 protected override bool CanExecute(object parameter)
 {
     try
     {
         return(CanExecuteDelegate?.Invoke() ?? true);
     }
     catch (Exception ex)
     {
         _registry.HandledException(ex);
         return(false);
     }
 }
Example #13
0
        public ReactiveCommand(CommandExecuteDelegate execute = null, CanExecuteDelegate canExecute = null, PropertyChangedWatcher propertyWatcher = null)
        {
            ReasonsDisabled = new ObservableCollection <string>();

            CanExecuteMethod = canExecute;
            ExecuteMethod    = execute;
            PropertyWatcher  = propertyWatcher;

            if (PropertyWatcher != null)
            {
                PropertyWatcher.PropertyChangedCallback += this.WatchedPropertyChangedEventHandler;
            }
        }
Example #14
0
            public CommandExecutionProvider(Type targetType, string canExecuteMethodName, string executedMethodName)
            {
                this.TargetType           = targetType;
                this.CanExecuteMethodName = canExecuteMethodName;
                this.ExecutedMethodName   = executedMethodName;

                var canExecuteMethodInfo = this.GetMethodInfo(this.CanExecuteMethodName);

                if (canExecuteMethodInfo != null && canExecuteMethodInfo.ReturnType == typeof(bool))
                {
                    if (canExecuteMethodInfo.GetParameters().Length == 0)
                    {
                        this._canExecute = (CanExecuteDelegate)
                                           Delegate.CreateDelegate(typeof(CanExecuteDelegate), null, canExecuteMethodInfo);
                    }
                    else
                    {
                        this._canExecuteWithParam = (CanExecuteWithParamDelegate)
                                                    Delegate.CreateDelegate(typeof(CanExecuteWithParamDelegate), null, canExecuteMethodInfo);
                    }
                }
                if (this._canExecute == null && this._canExecuteWithParam == null)
                {
                    throw new Exception(string.Format(
                                            "Method {0} on type {1} does not have a valid method signature. The method must have one of the following signatures: 'public bool CanExecute()' or 'public bool CanExecute(object parameter)'",
                                            this.CanExecuteMethodName, typeof(TTarget)));
                }

                var executedMethodInfo = this.GetMethodInfo(this.ExecutedMethodName);

                if (executedMethodInfo != null && executedMethodInfo.ReturnType == typeof(void))
                {
                    if (executedMethodInfo.GetParameters().Length == 0)
                    {
                        this._executed = (ExecutedDelegate)
                                         Delegate.CreateDelegate(typeof(ExecutedDelegate), null, executedMethodInfo);
                    }
                    else
                    {
                        this._executedWithParam = (ExecutedWithParamDelegate)
                                                  Delegate.CreateDelegate(typeof(ExecutedWithParamDelegate), null, executedMethodInfo);
                    }
                }
                if (this._executed == null && this._executedWithParam == null)
                {
                    throw new Exception(string.Format(
                                            "Method {0} on type {1} does not have a valid method signature. The method must have one of the following signatures: 'public void Executed()' or 'public void Executed(object parameter)'",
                                            this.ExecutedMethodName, typeof(TTarget)));
                }
            }
Example #15
0
        public CommandBindingWrapper(UIElement uiElement, Key key, CanExecuteDelegate canExecute, OnClickDelegate onClick)
        {
            var keyGesture = new KeyGesture(key, ModifierKeys.Control);
            var keyBinding = new KeyBinding(_command, keyGesture);

            _keyBinding = keyBinding;
            var commandBinding = new CommandBinding();

            commandBinding.Command     = _command;
            commandBinding.CanExecute += (obj, args) => { args.CanExecute = canExecute(); };
            commandBinding.Executed   += (obj, args) => onClick();
            _commandBinding            = commandBinding;
            uiElement.CommandBindings.Add(_commandBinding);
            uiElement.InputBindings.Add(_keyBinding);
        }
        protected override bool CanExecute(object parameter)
        {
            try
            {
                T param = default;
                if (parameter is T TParam)
                {
                    param = TParam;
                }
                else if (parameter != null && ThrowOnInvalidCast)
                {
                    throw new InvalidCastException($"The Command expected a typeof '{typeof(T).FullName}' but recieved a parameter of type '{parameter.GetType().FullName}");
                }

                return(CanExecuteDelegate?.Invoke(param) ?? true);
            }
            catch (Exception ex)
            {
                _registry.HandledException(ex);
                return(false);
            }
        }
Example #17
0
 /// <summary>
 /// <ja>
 /// コマンドが実行される際に呼び出すデリゲートと、メニューやツールバーが選択可能かどうかを示すデリゲートを指定したコンストラクタです。
 /// </ja>
 /// <en>
 /// Constructor that specified delegate that shows whether delegate, menu, and toolbar called when command is executed can be selected
 /// </en>
 /// </summary>
 /// <param name="execute">
 /// <ja>
 /// コマンドが実行される際に呼び出されるデリゲートです。
 /// </ja>
 /// <en>
 /// Delegate called when command is executed.
 /// </en>
 /// </param>
 /// <param name="canExecute">
 /// <ja>メニューやツールバーをイネーブルにするかディスエブルにするかを決めるときに呼び出されるデリゲートです。</ja>
 /// <en>Delegate called when whether menu and toolbar are made Inabl or making to disable is decided.</en>
 /// </param>
 /// <remarks>
 /// <ja>
 /// <para>
 /// コマンドが実行される際——言い換えると<seealso cref="IPoderosaCommand">IPoderosaCommand</seealso>の
 /// <see cref="IPoderosaCommand.InternalExecute">InternalExecute</see>メソッドが呼び出されるときに、<paramref name="execute">execute</paramref>
 /// に指定したデリゲートが呼び出されます。
 /// </para>
 /// <para>
 /// メニューやツールバーをイネーブルにするかディスエブルにするかを決めるとき——
 /// 言い換えると<seealso cref="IPoderosaCommand">IPoderosaCommand</seealso>の<see cref="IPoderosaCommand.CanExecute">CanExecute</see>メソッドが呼び出されるときに、
 /// <paramref name="canExecute">canExecute</paramref>に指定したデリゲートが呼び出されます。
 /// </para>
 /// </ja>
 /// <en>
 /// <para>
 /// When the <see cref="IPoderosaCommand.InternalExecute">InternalExecute</see> method of <seealso cref="IPoderosaCommand">IPoderosaCommand</seealso> is called, specified delegate is called in execute when paraphrasing it when the command is executed. 
 /// </para>
 /// <para>
 /// In the processing of the <see cref="IPoderosaCommand.CanExecute">CanExecute</see> method of <seealso cref="IPoderosaCommand">IPoderosaCommand</seealso>, true is always implemented so that it is returned. 
 /// </para>
 /// </en>
 /// </remarks>
 public PoderosaCommandImpl(ExecuteDelegate execute, CanExecuteDelegate canExecute) {
     _execute = execute;
     _canExecute = canExecute;
 }
Example #18
0
 /// <summary>
 /// <ja>
 /// 引数なしのコンストラクタです。
 /// </ja>
 /// <en>
 /// Constructor that doesn't have argument
 /// </en>
 /// </summary>
 /// <remarks>
 /// <ja>
 /// このコンストラクタで作成されたコマンドは、コマンドが実行されてもいかなる処理もしません。
 /// </ja>
 /// <en>
 /// The command made by this constructor is executed the command or doesn't do the becoming it processing either. 
 /// </en>
 /// </remarks>
 /// <overloads>
 /// <summary>
 /// <ja>
 /// コマンドオブジェクトを作成します。
 /// </ja>
 /// <en>
 /// Making the command object. 
 /// </en>
 /// </summary>
 /// </overloads>
 public PoderosaCommandImpl() {
     _execute = null;
     _canExecute = null;
 }
Example #19
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="actionExecute">The action to execute.</param>
 /// <param name="actionCanExecute">Parameter indicating if the action can be executed.</param>
 public ActionCommand(Action <object> actionExecute, CanExecuteDelegate actionCanExecute = null)
 {
     _actionExecute    = actionExecute;
     _actionCanExecute = actionCanExecute;
 }
Example #20
0
 public TerminalUICommand(string id, string description, ExecuteDelegate body, CanExecuteDelegate enabled)
     :
     base(id, TerminalUIPlugin.Instance.Strings, description, TerminalUIPlugin.Instance.TerminalEmulatorPlugin.TerminalCommandCategory, body, enabled) {
 }
        /// <summary>
        /// Constructs the command binding class, using the given Action delegate for the execution command.
        /// Using this constructor means the command will always be able to execute.
        /// </summary>
        /// <param name="executeCommand"></param>
        public CommandBinding(Action executeCommand)
        {
            _executionDelegate = executeCommand;
            _canExecuteDelegate = () => true;

        }
		public CommandExecutionContext (IRunTarget project, CanExecuteDelegate runCheckDelegate)
		{
			this.project = project as SolutionItem;
			this.runCheckDelegate = runCheckDelegate;
		}
 public CustomCommand(CanExecuteDelegate can, ExecuteDelegate exe)
 {
     CanExecuteMethod = can;
     ExecuteMethod    = exe;
 }
 public RelayCommand(ExecuteDelegate p1, CanExecuteDelegate p2)
 {
     e = p1;
     c = p2;
 }
 public DelegateCommand(ExecuteDelegate execMethod, CanExecuteDelegate canExecMethod = null)
 {
     _execMethod    = execMethod;
     _canExecMethod = canExecMethod;
 }
Example #26
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="execute">Метод, обрабатывающий выполнение команды</param>
 /// <param name="canExecute">Метод, определяющий, может ли быть выполнена команда</param>
 public CommandHandler(ExecuteDelegate execute, CanExecuteDelegate canExecute)
     : this(execute, null, canExecute)
 {
 }
 /// <summary>
 /// コンストラクタ(実行可否チェックあり)
 /// </summary>
 /// <param name="cmdID">コマンドID</param>
 /// <param name="textID">コマンド説明文ID</param>
 /// <param name="body">実行Delegate</param>
 /// <param name="enabled">実行可否Delegate</param>
 public ConnectProfileCommand(string cmdID, string textID, ExecuteDelegate body, CanExecuteDelegate enabled)
     : base(cmdID, ConnectProfilePlugin.Strings, textID, ConnectProfilePlugin.Instance.TerminalEmulatorService.TerminalCommandCategory, body, enabled)
 {
 }
        /// <summary>
        /// コマンド登録
        /// </summary>
        /// <param name="cm">コマンドマネージャ</param>
        public static void Register(ICommandManager cm)
        {
            // 実行可否Delegate
            CanExecuteDelegate does_open_target_session = new CanExecuteDelegate(DoesOpenTargetSession);

            // 登録
            cm.Register(new ConnectProfileCommand(ConnectProfilePlugin.CMD_ID_MAIN, "Command.ConnectProfile", new ExecuteDelegate(MainWindow)));
            cm.Register(new ConnectProfileCommand(ConnectProfilePlugin.CMD_ID_ADDPROFILE, "Command.AddConnectProfile", new ExecuteDelegate(AddConnectProfile), does_open_target_session));
        }
Example #29
0
 public DelegateCommand(ExecuteDelegate execute, CanExecuteDelegate canExecute)
 {
     this._execute = execute;
     this._canExecute = canExecute;
 }
 /// <summary>
 /// Constructs the command binding class, using the given Action delegate, along with a CanExecuteDelegate
 /// </summary>
 /// <param name="executeCommand"></param>
 /// <param name="canExecuteDelegate"></param>
 public CommandBinding(Action executeCommand, CanExecuteDelegate canExecuteDelegate)
 {
     _executionDelegate = executeCommand;
     _canExecuteDelegate = canExecuteDelegate;
 }
Example #31
0
 public DelegateCommand(ExecuteDelegate execute, CanExecuteDelegate canExecute)
 {
     executeDelegate    = execute;
     canExecuteDelegate = canExecute;
 }
 public bool CanExecute(object parameter)
 {
     return(CanExecuteDelegate?.Invoke(parameter) ?? true);
 }
Example #33
0
 public TerminalUICommand(string id, string description, ExecuteDelegate body, CanExecuteDelegate enabled)
     :
     base(id, TerminalUIPlugin.Instance.Strings, description, TerminalUIPlugin.Instance.TerminalEmulatorPlugin.TerminalCommandCategory, body, enabled)
 {
 }
Example #34
0
 public DelegateCommand(ExecuteDelegate execute, CanExecuteDelegate canExecute)
 {
     this._execute    = execute;
     this._canExecute = canExecute;
 }
Example #35
0
 public TerminalCommand(string id, string description, CommandCategory category, ExecuteDelegate body, CanExecuteDelegate enabled)
     :
     base(id, GEnv.Strings, description, category, body, enabled) {
 }
Example #36
0
 //一部要素を省略するコンストラクタ群
 /// <summary>
 /// <ja>
 /// コマンドID、カルチャ、説明テキスト文、コマンドカテゴリ、コマンドが実行される際に呼び出されるデリゲート、実行可能かどうかを調べる際に呼び出されるデリゲートを指定してオブジェクトを作成します。
 /// </ja>
 /// <en>
 /// The object is made specifying delegate called when delegate called when command ID, Culture, explanation text ID, the command category, and the command are executed and it is executable is examined. 
 /// </en>
 /// </summary>
 /// <param name="commandID">
 /// <ja>
 /// 割り当てるコマンドIDです。ほかのコマンドとは重複しない唯一無二のものを指定しなければなりません。
 /// </ja>
 /// <en>
 /// It is allocated command ID. The unique one that doesn't overlap should be specified other commands. 
 /// </en>
 /// </param>
 /// <param name="description">
 /// <ja>
 /// コマンドの説明文を示すテキストです。
 /// </ja>
 /// <en>
 /// Text that shows explanation of command
 /// </en>
 /// </param>
 /// <param name="category">
 /// <ja>
 /// コマンドのカテゴリです。
 /// </ja>
 /// <en>
 /// Category of command.
 /// </en>
 /// </param>
 /// <param name="execute">
 /// <ja>
 /// コマンドが実行されるときに呼び出されるデリゲートです。
 /// </ja>
 /// <en>
 /// Delegate called when command is executed.
 /// </en>
 /// </param>
 /// <param name="canExecute">
 /// <ja>
 /// コマンドが実行可能かどうかを調べる際に呼び出されるデリゲートです。
 /// </ja>
 /// <en>
 /// Dalagate called when it is examined whether the command is executable. 
 /// </en>
 /// </param>
 public GeneralCommandImpl(string commandID, string description, ICommandCategory category, ExecuteDelegate execute, CanExecuteDelegate canExecute)
     : this(commandID, null, description, category, execute, canExecute) {
 }
Example #37
0
 public ActionCommand(ExecuteDelegate execute, CanExecuteDelegate canExecute)
 {
     this.canExecute = canExecute;
     this.execute    = execute;
 }
Example #38
0
 public RelayCommand(ExecuteDelegate execute, 
     CanExecuteDelegate canExecute)
 {
     this.execute = execute;
     this.canExecute = canExecute;
 }
Example #39
0
 public ViewModelCommand(ExecuteDelegate execute, CanExecuteDelegate canExecute)
 {
     m_execute       = execute       ?? s_defaultExecute     ;
     m_canExecute    = canExecute    ?? s_defaultCanExecute  ;
 }
 public CommandExecutionContext(SolutionItem project, CanExecuteDelegate runCheckDelegate)
 {
     this.project          = project;
     this.runCheckDelegate = runCheckDelegate;
 }
 public DelegateCommand(ExecuteDelegate execute, CanExecuteDelegate canExecute)
 { 
     executeDelegate = execute;
     canExecuteDelegate = canExecute;
 }
 public CommandExecutionContext(IRunTarget project, CanExecuteDelegate runCheckDelegate)
 {
     this.project          = project as SolutionItem;
     this.runCheckDelegate = runCheckDelegate;
 }
Example #43
0
 //Konstruktor
 public UserCommand(CanExecuteDelegate can, ExecuteDelegate exe)
 {
     this.CanExecuteMethode = can;
     this.ExecuteMethode    = exe;
 }
Example #44
0
 public BasicCommand(string id, string description, CommandCategory category, Keys defaultkey, ExecuteDelegate body, CanExecuteDelegate enabled)
     :
     base(id, CoreUtil.Strings, description, category, body, enabled)
 {
     _defaultShortcutKey = defaultkey;
 }
Example #45
0
 /// <summary>
 /// <ja>
 /// コマンドが実行される際に呼び出すデリゲートを指定したコンストラクタです。
 /// </ja>
 /// <en>
 /// Constructor who specified delegate called when command is executed
 /// </en>
 /// </summary>
 /// <param name="execute">
 /// <ja>
 /// コマンドが実行される際に呼び出されるデリゲートです。
 /// </ja>
 /// <en>
 /// Delegate called when command is executed
 /// </en>
 /// </param>
 /// <remarks>
 /// <ja>
 /// <para>
 /// コマンドが実行される際——言い換えると<seealso cref="IPoderosaCommand">IPoderosaCommand</seealso>の
 /// <see cref="IPoderosaCommand.InternalExecute">InternalExecute</see>メソッドが呼び出されるときに、<paramref name="execute">execute</paramref>
 /// に指定したデリゲートが呼び出されます。
 /// </para>
 /// <para>
 /// <seealso cref="IPoderosaCommand">IPoderosaCommand</seealso>の<see cref="IPoderosaCommand.CanExecute">CanExecute</see>メソッドの処理では、常にtrueが返されるように実装されます。
 /// </para>
 /// </ja>
 /// <en>
 /// <para>
 /// When the <see cref="IPoderosaCommand.InternalExecute">InternalExecute</see> method of <seealso cref="IPoderosaCommand">IPoderosaCommand</seealso> is called, specified delegate is called in execute when paraphrasing it when the command is executed. 
 /// </para>
 /// <para>
 /// In the processing of the <see cref="IPoderosaCommand.CanExecute">CanExecute</see> method of <seealso cref="IPoderosaCommand">IPoderosaCommand</seealso>, true is always implemented so that it is returned. 
 /// </para>
 /// </en>
 /// </remarks>
 public PoderosaCommandImpl(ExecuteDelegate execute) {
     _execute = execute;
     _canExecute = null;
 }
Example #46
0
 public TerminalCommand(string id, string description, CommandCategory category, ExecuteDelegate body, CanExecuteDelegate enabled)
     :
     base(id, GEnv.Strings, description, category, body, enabled)
 {
 }
Example #47
0
 //必須要素を与えるコンストラクタ
 /// <summary>
 /// <ja>
 /// コマンドID、カルチャ、説明テキストID、コマンドカテゴリ、コマンドが実行される際に呼び出されるデリゲート、実行可能かどうかを調べる際に呼び出されるデリゲートを指定してオブジェクトを作成します。
 /// </ja>
 /// <en>
 /// The object is made specifying delegate called when delegate called when command ID, Culture, explanation text ID, the command category, and the command are executed and it is executable is examined. 
 /// </en>
 /// </summary>
 /// <param name="commandID">
 /// <ja>
 /// 割り当てるコマンドIDです。ほかのコマンドとは重複しない唯一無二のものを指定しなければなりません。
 /// </ja>
 /// <en>
 /// It is allocated command ID. The unique one that doesn't overlap should be specified other commands. 
 /// </en>
 /// </param>
 /// <param name="sr">
 /// <ja>
 /// カルチャ情報です。
 /// </ja>
 /// <en>
 /// Information of the culture.
 /// </en>
 /// </param>
 /// <param name="descriptionTextID">
 /// <ja>
 /// コマンドの説明文を示すテキストIDです。
 /// </ja>
 /// <en>
 /// Text ID that shows explanation of command
 /// </en>
 /// </param>
 /// <param name="commandCategory">
 /// <ja>
 /// コマンドのカテゴリです。
 /// </ja>
 /// <en>
 /// Category of command.
 /// </en>
 /// </param>
 /// <param name="exec">
 /// <ja>
 /// コマンドが実行されるときに呼び出されるデリゲートです。
 /// </ja>
 /// <en>
 /// Delegate called when command is executed.
 /// </en>
 /// </param>
 /// <param name="canExecute">
 /// <ja>
 /// コマンドが実行可能かどうかを調べる際に呼び出されるデリゲートです。
 /// </ja>
 /// <en>
 /// Delegate called when it is examined whether command is executable
 /// </en>
 /// </param>
 /// <overloads>
 /// <summary>
 /// <ja>
 /// コマンドオブジェクトを作成します。
 /// </ja>
 /// <en>
 /// Create the command object.
 /// </en>
 /// </summary>
 /// </overloads>
 public GeneralCommandImpl(string commandID, StringResource sr, string descriptionTextID, ICommandCategory commandCategory, ExecuteDelegate exec, CanExecuteDelegate canExecute) {
     _commandID = commandID;
     _usingStringResource = sr != null;
     _strResource = sr;
     _descriptionTextID = descriptionTextID;
     _commandCategory = commandCategory;
     _executeDelegate = exec;
     _canExecuteDelegate = canExecute;
 }
		public CommandExecutionContext (SolutionItem project, CanExecuteDelegate runCheckDelegate)
		{
			this.project = project;
			this.runCheckDelegate = runCheckDelegate;
		}
Example #49
0
 public DelegateCommand(ExecuteDelegate <T> execute, CanExecuteDelegate <T> canExecute)
 {
     this.canExecute = canExecute;
     this.execute    = execute;
 }
Example #50
0
 /// <summary>
 /// A RelayCommand can always execute.
 /// </summary>
 /// <param name="parameter"></param>
 /// <returns></returns>
 public bool CanExecute(object parameter) => CanExecuteDelegate?.Invoke() ?? true;
Example #51
0
 public RelayCommand(ExecuteDelegate execute,
                     CanExecuteDelegate canExecute)
 {
     this.execute    = execute;
     this.canExecute = canExecute;
 }
Example #52
0
 public BasicCommand(string id, string description, CommandCategory category, Keys defaultkey, ExecuteDelegate body, CanExecuteDelegate enabled)
     : base(id, CoreUtil.Strings, description, category, body, enabled)
 {
     _defaultShortcutKey = defaultkey;
 }