Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/UndoRedo/Commands/AddMultiPointShapeCommand.cs @ 4068

Last change on this file since 4068 was 4068, checked in by swagner, 14 years ago

Sorted usings and removed unused usings in entire solution (#1094)

File size: 1011 bytes
Line 
1using System;
2using System.Drawing;
3namespace Netron.Diagramming.Core {
4  /// <summary>
5  /// ICommand implementation of the AddShape action
6  /// </summary>
7  class AddMultiPointShapeCommand : Command {
8    IShape shape;
9
10    public IShape Shape {
11      get { return shape; }
12    }
13
14
15
16    public AddMultiPointShapeCommand(IController controller, IShape shape)
17      : base(controller) {
18      if (shape == null)
19        throw new ArgumentNullException("The shape is 'null' and cannot be inserted.");
20      this.Text = "Add " + shape.EntityName;
21
22
23      this.shape = shape;
24    }
25
26    public override void Redo() {
27      Controller.Model.AddShape(shape);
28      Rectangle rec = shape.Rectangle;
29      rec.Inflate(20, 20);
30      Controller.View.Invalidate(rec);
31    }
32
33    public override void Undo() {
34      Rectangle rec = shape.Rectangle;
35      rec.Inflate(20, 20);
36      Controller.Model.RemoveShape(shape);
37
38      Controller.View.Invalidate(rec);
39
40    }
41
42
43  }
44
45}
Note: See TracBrowser for help on using the repository browser.