public void Redo() { SignalManager.Get <PasteElementSignal>().Dispatch(_item.Parent, _item); SignalManager.Get <CreateNewElementSignal>().Dispatch(_item); ProjectItemFileSystem.CreateElement(_item, _item.FileHandler.Path, _item.DisplayName); }
public override void Execute(object parameter) { if (ItemSelected.FileHandler == null) { return; } if (ClipboardManager.GetData() is ProjectItem newItem) { string newItemPath = string.Empty; string name = string.Empty; if (ItemSelected.IsFolder) { newItemPath = Path.Combine(ItemSelected.FileHandler.Path, ItemSelected.FileHandler.Name); } else { newItemPath = ItemSelected.FileHandler.Path; } if (newItem.IsFolder) { name = ProjectItemFileSystem.GetValidFolderName(newItemPath, newItem.DisplayName); } else { string extension = Util.GetExtensionByType(ItemSelected.Type); name = ProjectItemFileSystem.GetValidFileName(newItemPath, newItem.DisplayName, extension); } newItem.RenamedFromAction = true; newItem.DisplayName = name; newItem.IsLoaded = true; SignalManager.Get <RegisterHistoryActionSignal>().Dispatch(new PasteProjectItemHistoryAction(newItem)); SignalManager.Get <PasteElementSignal>().Dispatch(ItemSelected, newItem); ProjectItemFileSystem.CreateElement(newItem, newItemPath, name); } }