Files
bluflame/intromat/Intromat/Actions/Hierarchy/CreateFileAction.cs
2026-04-18 22:31:51 +02:00

35 lines
837 B
C#

using System;
using DynamicData;
using Intromat.Interfaces;
using Intromat.ViewModels;
namespace Intromat.Actions.Hierarchy
{
public class CreateFileAction : IUndoItem
{
private readonly FileViewModel _file;
private readonly FolderViewModel _parent;
public CreateFileAction(MainViewModel mainVm, FileViewModel file, ModuleViewModel module, FolderViewModel parent)
{
_file = file;
_parent = parent;
File = module;
}
public IFile File { get; }
public void Redo()
{
_parent.Files.Add(_file);
_parent.IsExpanded = true;
_file.IsSelected = true;
}
public void Undo()
{
_parent.Files.Remove(_file);
_parent.IsSelected = true;
}
}
}