public void DeleteDocument(string parentSubPath, ProjectItemType type, string documentName) { var fileName = ""; if (type == ProjectItemType.Page) { fileName = $"{documentName}.{Constants.ProjectItemFileExtensions.Page}"; } if (type == ProjectItemType.Workflow) { fileName = $"{documentName}.{Constants.ProjectItemFileExtensions.Workflow}"; } var filePath = Path.Combine(Path.GetDirectoryName(_projectFilePath), parentSubPath, fileName); if (!File.Exists(filePath)) { throw new ArgumentException($"A {type.ToString()} named '{fileName}' does not exist in this directory and cannot be deleted!"); } _cmdProcessor.Execute(DeleteDocumentCommand.Create(_outputService, _projectFilePath, parentSubPath, fileName)); ProjectItemChanged?.Invoke(new ProjectItemChangedArgs { ItemType = type, Change = ProjectItemChange.Delete, ItemName = documentName, ParentSubPath = parentSubPath }); }
private void DoRenameModule(string currentName, string newName) { _cmdProcessor.Execute(RenameModuleCommand.Create(_outputService, _projectFilePath, currentName, newName, LoadedProject, SaveProject)); ProjectItemChanged?.Invoke(new ProjectItemChangedArgs { ItemType = ProjectItemType.Module, Change = ProjectItemChange.Rename, ItemName = newName, ItemNameOld = currentName }); }
public void AddPage(string parentSubPath, string pageName) { var fileName = $"{pageName}.{Constants.ProjectItemFileExtensions.Page}"; var filePath = Path.Combine(Path.GetDirectoryName(_projectFilePath), parentSubPath, fileName); if (File.Exists(filePath)) { throw new ArgumentException($"A page named '{fileName}' already exists in this directory!"); } _cmdProcessor.Execute(AddPageCommand.Create(_outputService, _projectFilePath, parentSubPath, pageName)); ProjectItemChanged?.Invoke(new ProjectItemChangedArgs { ItemType = ProjectItemType.Page, Change = ProjectItemChange.Create, ItemName = pageName, ParentSubPath = parentSubPath }); }
public void AddFolder(string parentSubPath, string newFolderName) { // Darf noch nicht existieren var folderPath = Path.Combine(Path.GetDirectoryName(_projectFilePath), parentSubPath, newFolderName); if (Directory.Exists(folderPath)) { throw new ArgumentException($"A folder named '{newFolderName}' already exists in this directory!"); } _cmdProcessor.Execute(AddFolderCommand.Create(_outputService, _projectFilePath, parentSubPath, newFolderName)); ProjectItemChanged?.Invoke(new ProjectItemChangedArgs { ItemType = ProjectItemType.Folder, Change = ProjectItemChange.Create, ItemName = newFolderName, ParentSubPath = parentSubPath }); }