Пример #1
0
        private void NewSelectPanel_MouseUp(object sender, MouseEventArgs e)
        {
            ResetColors();
            NewDrawingCommand command = new NewDrawingCommand(TargetDrawing);

            _invoker.EnqueueCommandForExecution(command);
        }
Пример #2
0
 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();
     }
 }
Пример #3
0
        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);
        }