private void NewSelectPanel_MouseUp(object sender, MouseEventArgs e) { ResetColors(); NewDrawingCommand command = new NewDrawingCommand(TargetDrawing); _invoker.EnqueueCommandForExecution(command); }
private void MainForm_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 'n' || e.KeyChar == 'N') { NewDrawingCommand command = new NewDrawingCommand(TargetDrawing); _invoker.EnqueueCommandForExecution(command); } else if (e.KeyChar == 's' || e.KeyChar == 'S') { Save(); } else if (e.KeyChar == 'o' || e.KeyChar == 'O') { Open(); } else if (e.KeyChar == 'u' || e.KeyChar == 'U') { _invoker.Undo(); } else if (e.KeyChar == 'r' || e.KeyChar == 'R') { _invoker.Redo(); } }
public void NewDiagramTest() //tests the creation of a new drawing. { _testInvoker.Start(); Color newBackgroundColor = Color.Aqua; Color newForegroundColor = Color.Beige; string newDrawingName = "New Name"; Color newDefaultClassColor = Color.Purple; EditDiagramCommand cmd = new EditDiagramCommand(newDrawingName, newBackgroundColor, newForegroundColor, newDefaultClassColor, testDrawing); _testInvoker.EnqueueCommandForExecution(cmd); System.Threading.Thread.Sleep(1000); NewDrawingCommand newCommand = new NewDrawingCommand(testDrawing); _testInvoker.EnqueueCommandForExecution(newCommand); System.Threading.Thread.Sleep(1000); Assert.AreEqual("New Drawing", testDrawing.DrawingName); Assert.AreEqual(Color.White, testDrawing.BackGroundColor); Assert.AreEqual(Color.Black, testDrawing.ForeGroundColor); Assert.AreEqual(Color.LightBlue, testDrawing.DefaultClassColor); }