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