public override void AfterLabelEdit(string newName) { if (newName == null) { return; } if (!FileService.CheckFileName(newName)) { return; } string newFileName = Path.Combine(Path.GetDirectoryName(this.FileName), newName); if (!FileService.RenameFile(this.FileName, newFileName, false)) { return; } solution.Save(); }
public override void AfterLabelEdit(string newName) { try { if (solution.Name == newName) { return; } if (!FileService.CheckFileName(newName)) { return; } string newFileName = Path.Combine(solution.Directory, newName + ".sln"); if (!FileService.RenameFile(solution.FileName, newFileName, false)) { return; } solution.FileName = newFileName; solution.Name = newName; } finally { UpdateText(); } }
protected override void OnAfterLabelEdit(LabelEditEventArgs e) { base.OnAfterLabelEdit(e); if (e.Label == null || !FileService.CheckFileName(e.Label)) { e.CancelEdit = true; return; } string oldFileName = ((FileListItem)Items[e.Item]).FullName; string newFileName = Path.Combine(Path.GetDirectoryName(oldFileName), e.Label); if (FileService.RenameFile(oldFileName, newFileName, false)) { ((FileListItem)Items[e.Item]).FullName = newFileName; } else { e.CancelEdit = true; } }