32 lines
808 B
C#
32 lines
808 B
C#
using DynamicData;
|
|
using Intromat.Interfaces;
|
|
using Intromat.ViewModels;
|
|
using NodeNetwork.ViewModels;
|
|
|
|
namespace Intromat.Actions.Network
|
|
{
|
|
public class AddConnectionAction : IUndoItem
|
|
{
|
|
private readonly CodeGenNetworkViewModel _network;
|
|
private readonly ConnectionViewModel _connection;
|
|
|
|
public AddConnectionAction(DocumentViewModel document, CodeGenNetworkViewModel network, ConnectionViewModel connection)
|
|
{
|
|
File = document;
|
|
_network = network;
|
|
_connection = connection;
|
|
}
|
|
|
|
public void Redo()
|
|
{
|
|
_network.Connections.Add(_connection);
|
|
}
|
|
|
|
public void Undo()
|
|
{
|
|
_network.Connections.Remove(_connection);
|
|
}
|
|
|
|
public IFile File { get; }
|
|
}
|
|
} |