This project is read-only.
Moving link shapes around does not change the links' sequence in the model XML, which the template is depended on.
How to generate correct code sequence based on the y-coordinates of the shapes?

Thanks to this thread's hint.

I created a partial class with a hidden property.

public partial class Link
public int DisplayIndex { get; set; }

And in the template, load the .diagram file, parse to get y-coordinate and sort the links.

XmlDocument doc = new System.Xml.XmlDocument();

List<Link> links = new List<Link>();
foreach (Link link in this.TopNav.Links)
string s = string.Format("//linkShape[contains(./linkMoniker/@name, '0')]", link.Name);

XmlNode node= doc.SelectSingleNode(s);
if (node != null)
string[] ss = node.Attributes["absoluteBounds"].Value.Split(',');
double f = Convert.ToDouble(ss[1]) * 100;
int y = Convert.ToInt32(f);
link.DisplayIndex = y;

delegate(Link l1, Link l2)
return l1.DisplayIndex.CompareTo(l2.DisplayIndex);

Last edited Feb 28, 2008 at 3:09 AM by yysun, version 3


No comments yet.