Exemplo n.º 1
0
        public override ICommand CreateCommand(NoteBookProvider provider, string commandString)
        {
            ICommand command = null;

            if (commandString.Contains(Resources.NewNoteBook))
            {
                command = new NewNoteBookCommand();
            }
            else if (Successor != null)
            {
                command = Successor.CreateCommand(provider, commandString);
            }
            return(command);
        }
        public override ICommand CreateCommand(NoteBookProvider provider, string commandString)
        {
            ICommand command = null;

            if (commandString.Contains(Resources.AddNote))
            {
                command = new AddNoteCommand(provider.GetNoteBook(), addNote);
            }
            else if (Successor != null)
            {
                Successor.CreateCommand(provider, commandString);
            }
            return(command);
        }
Exemplo n.º 3
0
        public override ICommand CreateCommand(NoteBookProvider provider, string commandString)
        {
            ICommand command = null;

            if (commandString.Contains(Resources.SetSource))
            {
                ParseCommandLine(commandString);
                command = new SetSourceCommand(provider, source);
            }
            else if (Successor != null)
            {
                command = Successor.CreateCommand(provider, commandString);
            }
            return(command);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            CommandCreator commandForNoteBook = new CreateCommandNewNoteBook(
                new CreateCommandOpenNoteBook(
                    new CreateCommandSaveNoteBook(
                        new CreateCommandSetSource())));
            NoteBookProvider nbp     = new NoteBookProvider(commandForNoteBook);
            Invoker          invoker = new Invoker(commandForNoteBook);

            try
            {
                nbp.SetCommand(Console.ReadLine());
                nbp.Run();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadLine();
        }
Exemplo n.º 5
0
 public abstract ICommand CreateCommand(NoteBookProvider provider, string commandString);