port from perforce
This commit is contained in:
31
intromat/Intromat/Actions/Hierarchy/DeleteModuleAction.cs
Normal file
31
intromat/Intromat/Actions/Hierarchy/DeleteModuleAction.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Intromat.Interfaces;
|
||||
using Intromat.ViewModels;
|
||||
|
||||
namespace Intromat.Actions.Hierarchy
|
||||
{
|
||||
public class DeleteModuleAction : IUndoItem
|
||||
{
|
||||
private readonly ModuleViewModel _module;
|
||||
private readonly ProjectViewModel _parent;
|
||||
|
||||
public DeleteModuleAction(ModuleViewModel module)
|
||||
{
|
||||
File = _parent = (ProjectViewModel)module.Parent;
|
||||
_module = module;
|
||||
}
|
||||
|
||||
public IFile File { get; }
|
||||
|
||||
public void Redo()
|
||||
{
|
||||
_parent.Modules.Remove(_module);
|
||||
_parent.IsSelected = true;
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
_parent.Modules.Add(_module);
|
||||
_module.IsSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user