예제 #1
0
 public ToolbarViewModel(MainWindowsViewModel mainvm)
 {
     _mainvm = mainvm;
     toolbar = new Toolbar {
         isShapeSelected = false, isDrawModeSelected = false
     };
     createShape = new ICommandImpl(obj => CreateShape((string)obj));
     changeSize  = new ICommandImpl(obj => ChangeShapeSize((string)obj));
     changeColor = new ICommandImpl(obj => ChangeShapeColor((string)obj));
     drawShape   = new ICommandImpl(obj => DrawShape());
     removeShape = new ICommandImpl(obj => RemoveShape());
 }
 public CanvasViewModel(MainWindowsViewModel mainvm)
 {
     _mainvm      = mainvm;
     DrawingBoard = new MyCanvas {
         canvas = new Canvas(), drawing = false
     };
     DrawingBoard.canvas.Background = new SolidColorBrush(Colors.WhiteSmoke);
     DrawingBoard.canvas.AllowDrop  = true;
     DrawingBoard.canvas.Focusable  = true;
     DrawingBoard.canvas.MouseDown += CanvasClicked;
     DrawingBoard.canvas.MouseMove += CanvasMove;
     DrawingBoard.canvas.MouseUp   += CanvasRelease;
 }