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); }
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); }
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(); }
public abstract ICommand CreateCommand(NoteBookProvider provider, string commandString);