34 lines
851 B
C#
34 lines
851 B
C#
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;
|
|
}
|
|
}
|
|
} |