port from perforce
This commit is contained in:
33
intromat/Intromat/Actions/Hierarchy/DeleteFolderAction.cs
Normal file
33
intromat/Intromat/Actions/Hierarchy/DeleteFolderAction.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using DynamicData;
|
||||
using Intromat.Interfaces;
|
||||
using Intromat.ViewModels;
|
||||
|
||||
namespace Intromat.Actions.Hierarchy
|
||||
{
|
||||
public class DeleteFolderAction : IUndoItem
|
||||
{
|
||||
private readonly FolderViewModel _folder;
|
||||
private readonly FolderViewModel _parent;
|
||||
|
||||
public DeleteFolderAction(FolderViewModel folder)
|
||||
{
|
||||
File = folder.Module;
|
||||
_parent = (FolderViewModel)folder.Parent;
|
||||
_folder = folder;
|
||||
}
|
||||
|
||||
public IFile File { get; }
|
||||
|
||||
public void Redo()
|
||||
{
|
||||
_parent.Folders.Remove(_folder);
|
||||
_parent.IsSelected = true;
|
||||
}
|
||||
|
||||
public void Undo()
|
||||
{
|
||||
_parent.Folders.Add(_folder);
|
||||
_folder.IsSelected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user