コード例 #1
0
ファイル: MenuSetup.cs プロジェクト: egoshin-igor/OOD
        private void SetTitleCommandExecutor(string commandParams)
        {
            var argumentsParser = new ArgumentsParser(commandParams);

            if (argumentsParser.NextArgumentsCount < 1)
            {
                throw new MenuException();
            }

            ICommand command = new SetTitleCommand(argumentsParser.GetNextsAsString(' '), _document);

            command.Execute();
        }
コード例 #2
0
ファイル: MenuSetup.cs プロジェクト: egoshin-igor/OOD
        private void InsertParagraphCommandExecutor(string commandParams)
        {
            var argumentsParser = new ArgumentsParser(commandParams);

            if (argumentsParser.NextArgumentsCount < 2)
            {
                throw new MenuException();
            }

            int?   position = GetPosition(argumentsParser.GetNextAsString());
            string text     = argumentsParser.GetNextsAsString(' ');

            ICommand command = new InsertParagraphCommand(text, _document, position);

            command.Execute();
        }
コード例 #3
0
ファイル: MenuSetup.cs プロジェクト: egoshin-igor/OOD
        private void ReplaceTextCommandExecutor(string commandParams)
        {
            var argumentsParser = new ArgumentsParser(commandParams);

            if (argumentsParser.NextArgumentsCount < 2)
            {
                throw new MenuException();
            }

            int?position = argumentsParser.GetNextAsInt();

            if (position == null)
            {
                throw new MenuException();
            }
            string text = argumentsParser.GetNextsAsString(' ');

            ICommand command = new ReplaceTextCommand(position.Value, text, _document);

            command.Execute();
        }