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