コード例 #1
0
ファイル: MainWindow.cs プロジェクト: yueker/poderosa
        public UIHandleResult OnKeyProcess(Keys key)
        {
            IGeneralCommand cmd = CommandManagerPlugin.Instance.Find(key);

            if (cmd != null)
            {
                try {
                    if (cmd.CanExecute(_window))
                    {
                        CommandManagerPlugin.Instance.Execute(cmd, _window);
                    }
                    return(UIHandleResult.Stop); //キーが割り当てられていれば実行ができるかどうかにかかわらずStop。でないとAltキーがらみのときメニューにフォーカスが奪われてしまう
                }
                catch (Exception ex) {
                    RuntimeUtil.ReportException(ex);
                }
            }
            return(UIHandleResult.Pass);
        }
コード例 #2
0
 public bool IsEnabled(ICommandTarget target)
 {
     return(_command.CanExecute(target));
 }