Beispiel #1
0
        public void PopulateShapeDataFromInfo(Visio.Shape shape, WorkItemShapeVersion shapeVersion)
        {
            // These changed between V1 and V2

            if (shapeVersion.Equals(WorkItemShapeVersion.V1))
            {
                shape.CellsU["Prop.CreatedBy"].FormulaU   = CreatedBy.WrapInDblQuotes();
                shape.CellsU["Prop.CreatedDate"].FormulaU = CreatedDate.WrapInDblQuotes();

                shape.CellsU["Prop.TeamProject"].FormulaU = TeamProject.WrapInDblQuotes();

                shape.CellsU["Prop.PageName"].FormulaU = WorkItemType.WrapInDblQuotes();

                shape.CellsU["Prop.State"].FormulaU = State.WrapInDblQuotes();

                shape.CellsU["Prop.ChangedBy"].FormulaU   = ChangedBy.WrapInDblQuotes();
                shape.CellsU["Prop.ChangedDate"].FormulaU = ChangedDate.WrapInDblQuotes();
            }
            else
            {
                // Map the properties to the corresponding Prop Data fields on the generic shape

                shape.CellsU["Prop.TextUpper2"].FormulaU = CreatedBy.WrapInDblQuotes();
                shape.CellsU["Prop.TextUpper1"].FormulaU = CreatedDate.WrapInDblQuotes();

                shape.CellsU["Prop.TextHeader2"].FormulaU = TeamProject.WrapInDblQuotes();

                shape.CellsU["Prop.WorkItemType"].FormulaU = WorkItemType.WrapInDblQuotes();

                //shape.CellsU["Prop.TextFooter2"].FormulaU = state.ToString().WrapInDblQuotes();
                shape.CellsU["Prop.TextFooter1"].FormulaU = State.WrapInDblQuotes();

                shape.CellsU["Prop.TextLower1"].FormulaU = ChangedBy.WrapInDblQuotes();
                shape.CellsU["Prop.TextLower2"].FormulaU = ChangedDate.WrapInDblQuotes();

                // Most likely PageName

                shape.CellsU["Prop.PageName"].FormulaU = $"{WorkItemType} {ID}".WrapInDblQuotes();

                shape.CellsU["Prop.RelatedBugs"].FormulaU = RelatedBugs.WrapInDblQuotes();
            }

            // These didn't change

            shape.CellsU["Prop.Organization"].FormulaU = Organization.WrapInDblQuotes();
            shape.CellsU["Prop.ID"].FormulaU           = ID.WrapInDblQuotes();

            shape.CellsU["Prop.Title"].FormulaU = Title.WrapInDblQuotes();

            shape.CellsU["Prop.RelatedLinks"].FormulaU  = RelatedLinkCount.WrapInDblQuotes();
            shape.CellsU["Prop.ExternalLinks"].FormulaU = ExternalLinkCount.WrapInDblQuotes();
            shape.CellsU["Prop.RemoteLinks"].FormulaU   = RemoteLinkCount.WrapInDblQuotes();
            shape.CellsU["Prop.HyperLinks"].FormulaU    = HyperLinkCount.WrapInDblQuotes();

            shape.CellsU["Prop.ExternalLink"].FormulaU =
                $"http://dev.azure.com/{Organization}/{TeamProject}/_workitems/edit/{ID}/".WrapInDblQuotes();

            shape.CellsU["Prop.AreaPath"].FormulaU      = AreaPath.WrapInDblQuotes();
            shape.CellsU["Prop.IterationPath"].FormulaU = IterationPath.WrapInDblQuotes();

            switch (WorkItemType)
            {
            case "Bug":
                shape.CellsU["Prop.FieldIssue"].FormulaU = FieldIssue.WrapInDblQuotes();
                break;

            case "User Story":
                shape.CellsU["Prop.TaskType"].FormulaU = TaskType.WrapInDblQuotes();
                break;

            default:
                break;
            }
        }