public override void AfterLabelEdit(string newName) { if (newName == null) { return; } if (!FileService.CheckFileName(newName)) { return; } if (!FileService.CheckDirectoryName(newName)) { return; } if (String.Compare(Text, newName, true) == 0) { return; } string oldText = Text; Text = newName; if (Directory != null) { string newPath = Path.Combine(Path.GetDirectoryName(Directory), newName); if (System.IO.Directory.Exists(newPath)) { if (System.IO.Directory.GetFileSystemEntries(newPath).Length == 0) { System.IO.Directory.Delete(newPath); FileService.RenameFile(Directory, newPath, true); } else { MessageService.ShowError("The folder already exists and contains files!"); Text = oldText; return; } } else { FileService.RenameFile(Directory, newPath, true); } this.directory = newPath; Project.Save(); } }