public async Task Rename(string path, AbstractFile file) { using (NewFolderForm CrtFldrFrm = new NewFolderForm()) { if (file.Type() == FileDir.File) { ConcreteFile CurrentFile = (ConcreteFile)file; CrtFldrFrm.SetItemName(CurrentFile.FileName); CrtFldrFrm.ShowDialog(); if (CrtFldrFrm.DialogResult == DialogResult.OK) { await client.Files.MoveAsync(new RelocationArg(CurrentFile.FilePath, path + "/" + CrtFldrFrm.FolderName)); } } if (file.Type() == FileDir.Folder) { ConcreteFolder CurrentFile = (ConcreteFolder)file; CrtFldrFrm.SetItemName(CurrentFile.FolderName); CrtFldrFrm.ShowDialog(); if (CrtFldrFrm.DialogResult == DialogResult.OK) { await client.Files.MoveAsync(new RelocationArg(CurrentFile.FolderPath, path + "/" + CrtFldrFrm.FolderName)); } } } }
public async Task CreateFolder(string NewFolder) { using (NewFolderForm CrtFldrFrm = new NewFolderForm()) { CrtFldrFrm.ShowDialog(); if (CrtFldrFrm.DialogResult == DialogResult.OK) { await client.Files.CreateFolderAsync(new CreateFolderArg(NewFolder + "/" + CrtFldrFrm.FolderName, true)); } } }
// Create a new folder. public void NewFolder() { NewFolderForm form = new NewFolderForm(currentDirectory); bool ok = false; try { if(form.ShowDialog(this) == DialogResult.OK) { ok = true; } } finally { form.DisposeDialog(); } if(ok) { String dir = form.FolderName; if(dir != null) { ChangeDirectory(dir); } } }