示例#1
0
        /// <summary>
        /// Redo操作が可能か調べます。
        /// </summary>
        private static void CanExecuteRedo(object sender, CanExecuteRelayEventArgs e)
        {
            var element = e.Parameter as GLShogiElement;
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            if (element.Board == null)
            {
                throw new InvalidOperationException(
                    "element.Boardがnullです。");
            }

            e.CanExecute = element.Board.CanRedo;
        }
示例#2
0
        /// <summary>
        /// コマンドの実行可能状態を調べます。
        /// </summary>
        public bool CanExecute()
        {
            if (this.canExecute == null)
            {
                return true;
            }

            var e = new CanExecuteRelayEventArgs(this);
            this.canExecute(this, e);
            return e.CanExecute;
        }