internal static async void GetWorkItemInfo(Visio.Shape shape, WorkItemShapeInfo.WorkItemShapeVersion version) { WorkItemShapeInfo shapeInfo = new WorkItemShapeInfo(shape); int id = 0; if (!int.TryParse(shapeInfo.ID, out id)) { MessageBox.Show($"Invalid WorkItem ID: ({shapeInfo.ID})"); return; } var result = await VNC.AZDO.Helper.QueryWorkItemInfoById(shapeInfo.Organization, id); if (result.Count == 0) { MessageBox.Show($"Cannot find WorkItem ID: ({shapeInfo.ID})"); return; } shapeInfo.InitializeFromWorkItem(result[0]); // NOTE(crhodes) // Go add the bugs int bugs = await VNC.AZDO.Helper.QueryRelatedBugsById(shapeInfo.Organization, int.Parse(shapeInfo.ID)); shapeInfo.RelatedBugs = bugs.ToString(); shapeInfo.PopulateShapeDataFromInfo(shape, version); VisioHelper.DisplayInWatchWindow($"{shapeInfo}"); }
private static async void AddNewWorkItemRevisionShapeToPage(Visio.Page page, Visio.Master linkMaster, WorkItem workItem, Point insertionPoint, WorkItemShapeInfo relatedShape, WorkItemShapeInfo.WorkItemShapeVersion version) { try { Visio.Shape newWorkItemShape = page.Drop(linkMaster, insertionPoint.X, insertionPoint.Y); WorkItemShapeInfo shapeInfo = new WorkItemShapeInfo(newWorkItemShape); shapeInfo.InitializeFromWorkItemRevision(workItem, int.Parse(relatedShape.ID)); //int bugs = await VNC.AZDO.Helper.QueryRelatedBugsById(shapeInfo.Organization, int.Parse(shapeInfo.ID)); //shapeInfo.RelatedBugs = bugs.ToString(); shapeInfo.PopulateShapeDataFromInfo(newWorkItemShape, version); } catch (Exception ex) { VisioHelper.DisplayInWatchWindow($"{workItem.Id} - {ex}"); } }