private void Undo_Clicked(object sender, PointerRoutedEventArgs e) { if (Undo != null) { Undo.Execute(null); } }
private void Undo_Clicked(object sender, MouseButtonEventArgs e) { if (Undo != null) { Undo.Execute(null); } }
public void WhenPassingAnInvalidIdShouldThrowAnException(string id) { var undoUseCase = new Undo(_dataGateway); Assert.Throws <BusinessException>(() => { undoUseCase.Execute(id); }); }
public void MarkItemIncompletedSuccess() { InMemoryContext inMemory = new InMemoryContext(); IItemGateway gateway = new InMemoryItemGateway(inMemory); IUseCase sut = new Undo(gateway); sut.Execute(existingTodoItemId); Assert.NotEmpty(inMemory.Items.Where(e => e.Id == new Guid(existingTodoItemId) && !e.Done)); }
public void MarkItemCompleted_ThrowsException_WhenItemDoesNotExist() { InMemoryContext inMemory = new InMemoryContext(); IItemGateway gateway = new InMemoryItemGateway(inMemory); IUseCase sut = new Undo(gateway); Exception ex = Record.Exception(() => sut.Execute(Guid.NewGuid().ToString())); Assert.NotNull(ex); Assert.IsType <BusinessException>(ex); }
public void ShouldMarkAnItemAsNotDone() { var undoUseCase = new Undo(_dataGateway); undoUseCase.Execute(_itemCreatedId); var notDoneItem = _dataContext.Items.FirstOrDefault(x => x.Id.ToString() == _itemCreatedId); Assert.NotNull(notDoneItem); Assert.False(notDoneItem.Done); }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { ICanvas canvas = this.editor.GetSelectedCanvas(); switch (keyData) { case Keys.Control | Keys.Z: undo.Execute(); break; case Keys.Control | Keys.Y: redo.Execute(); break; case Keys.Control | Keys.C: copy.Execute(); break; case Keys.Control | Keys.V: paste.Execute(); break; case Keys.Delete: DeleteObject deleteCommand = new DeleteObject(canvas); deleteCommand.Execute(); canvas.AddCommand(deleteCommand); break; case Keys.Control | Keys.Q: if (canvas != null) { ICommand command = new Exit(); command.Execute(); canvas.Repaint(); } break; case Keys.Control | Keys.S: if (canvas != null) { ICommand command = new Save(canvas); command.Execute(); canvas.Repaint(); } break; } return(base.ProcessCmdKey(ref msg, keyData)); }
public void Undo() { undo.Execute(); }
private void Undo(object sender, EventArgs e) { Undo undo = new Undo(); undo.Execute(textEditorControl); }
static void Prompt() { // If the directory nor the files exist, create them if (!Directory.Exists(copyPath)) { Directory.CreateDirectory(copyPath); } if (!File.Exists(copyPath + "\\copylist.tute")) { File.Create(copyPath + "\\copylist.tute").Close(); } while (!done) { Console.Write($"#{line} "); string command = Console.ReadLine(); string[] args = command.Split(new[] { ' ' }, 2); string[] argsFull = command.Split(' '); // Ask for a command, split it into two arrays, one where it only splits once and one when it constantly splits char[] check = args[0].ToCharArray(); // Convert the first argument of args into a char array switch (args[0]) { case "/save": var Save = new Save(); Save.ParseArgs(argsFull); Save.Execute(); break; case "/load": var Load = new Load(); Load.ParseArgs(argsFull); Load.Execute(); break; case "/undo": var Undo = new Undo(); Undo.Execute(); break; case "/redo": var Redo = new Redo(); Redo.Execute(); break; case "/copy": var Copy = new Copy(); Copy.ParseArgs(argsFull); Copy.Execute(); break; case "/paste": var Paste = new Paste(); var PasteReplace = new PasteReplace(); if ((argsFull.Length == 3) && (argsFull[1] == "r")) // if there are 3 arguments and the second one is r { PasteReplace.ParseArgs(argsFull); PasteReplace.Execute(); } else if ((argsFull.Length == 2) && (argsFull[1] == "a")) // if there are two arguments and the second one is a { Paste.ParseArgs(argsFull); Paste.Execute(); } else { Console.WriteLine(argError); } break; case "/dis": var Display = new Display(); Display.Execute(); break; case "/edit": var Edit = new Edit(); Edit.ParseArgs(argsFull); Edit.Execute(); break; case "/move": var Move = new Move(); Move.ParseArgs(argsFull); Move.Execute(); break; case "/del": var Delete = new Delete(); Delete.ParseArgs(argsFull); Delete.Execute(); break; case "/clear": Console.Clear(); break; case "/exit": var Exit = new Exit(); Exit.ParseArgs(args); Exit.Execute(); break; default: string fullCommand; // Initialize a full command string if (args.Length > 1) // if args has more than one argument { fullCommand = args[0] + " " + args[1]; // the full command is the argument 0, plus a space, plus the rest } else { fullCommand = args[0]; // else its just the arg 0 } if (check[0] == '/') // check if the char array made before has as its first letter a / { Console.WriteLine(syntaxError); } else { lines.Add(fullCommand); // add the command to the lines list line++; // increment the lines counter } hasSaved = false; break; } } }