Ejemplo n.º 1
0
        /// <summary>
        /// Undo用のCommandとしてEnterCommandを設定する
        /// </summary>
        internal override void SetUndoCommand()
        {
            var enterCommand = new EnterCommand();

            enterCommand.SetComponent(this.m_beforeComponent);
            base.m_undoCommand = enterCommand;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// コンストラクタ
        /// MemoTreeの起動を行う
        /// </summary>
        public Context()
        {
            // MemoTreeディレクトリの存在チェック
            var strInitPath = Directory.GetCurrentDirectory() + "/MemoTree";

            if (!Directory.Exists(strInitPath))
            {
                Directory.CreateDirectory(strInitPath);
            }
            this.m_componentMain = new DirComponent(strInitPath);
            // 全ディレクトリ、ファイルを再帰的に取得
            DirComponent.SetComponent(this.m_componentMain);
            this.m_currentComponent = this.m_componentMain;

            // 起動時はキー入力モードを設定
            this.m_stateInvoker = KeyInputStateInvoker.GetInstance();
            // 起動時はEnterコマンドを直接実行
            var enterCommand = new EnterCommand();

            enterCommand.CallExecute(this, this.m_componentMain, false);
        }
        /// <summary>
        /// Enterコマンドを実行する。
        /// </summary>
        /// <param name="context">Context.</param>
        private bool ExecuteEnterCommand(Context context, int iNumericKeyNo = -1)
        {
            // Enterコマンドを生成し、実行
            var       enterCommand = new EnterCommand();
            Component component    = null;

            if (iNumericKeyNo == -1)
            {
                // 親コンポーネントを取得
                var parentComponent = this.GetParentComponent(context.m_componentMain, context.m_currentComponent);
                if (parentComponent == null)
                {
                    return(false);
                }
                component = parentComponent;
            }
            else
            {
                component = context.m_currentComponent.m_listComponent[iNumericKeyNo];
            }
            enterCommand.CallExecute(context, component);
            return(true);
        }