internal static string Open(ExtendedItem item, Microsoft.TeamFoundation.VersionControl.Client.Workspace workspace) { using (var dialog = new RenameDialog(item)) { if (dialog.Run(Xwt.Toolkit.CurrentEngine.WrapWindow(MessageService.RootWindow)) == Command.Ok) { using (var progress = VersionControlService.GetProgressMonitor("Undo", VersionControlOperationType.Pull)) { progress.BeginTask("Rename", 1); List<Failure> failures; if (item.ItemType == Microsoft.TeamFoundation.VersionControl.Client.Enums.ItemType.File) workspace.PendRenameFile(item.LocalItem, dialog.NewPath, out failures); else workspace.PendRenameFolder(item.LocalItem, dialog.NewPath, out failures); if (failures != null && failures.Any(f => f.SeverityType == Microsoft.TeamFoundation.VersionControl.Client.Enums.SeverityType.Error)) { progress.EndTask(); foreach (var failure in failures.Where(f => f.SeverityType == Microsoft.TeamFoundation.VersionControl.Client.Enums.SeverityType.Error)) { progress.ReportError(failure.Code, new Exception(failure.Message)); } return string.Empty; } progress.EndTask(); progress.ReportSuccess("Finish Undo"); return dialog.NewPath; } } return string.Empty; } }
internal static string Open(ExtendedItem item, Microsoft.TeamFoundation.VersionControl.Client.Workspace workspace) { using (var dialog = new RenameDialog(item)) { if (dialog.Run(Xwt.Toolkit.CurrentEngine.WrapWindow(MessageService.RootWindow)) == Command.Ok) { using (var progress = VersionControlService.GetProgressMonitor("Undo", VersionControlOperationType.Pull)) { progress.BeginTask("Rename", 1); List <Failure> failures; if (item.ItemType == Microsoft.TeamFoundation.VersionControl.Client.Enums.ItemType.File) { workspace.PendRenameFile(item.LocalItem, dialog.NewPath, out failures); } else { workspace.PendRenameFolder(item.LocalItem, dialog.NewPath, out failures); } if (failures != null && failures.Any(f => f.SeverityType == Microsoft.TeamFoundation.VersionControl.Client.Enums.SeverityType.Error)) { progress.EndTask(); foreach (var failure in failures.Where(f => f.SeverityType == Microsoft.TeamFoundation.VersionControl.Client.Enums.SeverityType.Error)) { progress.ReportError(failure.Code, new Exception(failure.Message)); } return(string.Empty); } progress.EndTask(); progress.ReportSuccess("Finish Undo"); return(dialog.NewPath); } } return(string.Empty); } }