Example #1
0
 public override void ReadXThings()
 {
     ReadInto(VisualsCollection);
     foreach (var visual in VisualsCollection)
     {
         var thing = VisualThingGraph.Get(visual);
         if (thing != null && !Things.Contains(thing))
         {
             Things.Add(thing);
         }
     }
 }
Example #2
0
        public virtual XElement Write(IVisual visual)
        {
            XElement xmlthing = null;

            var thing = VisualThingGraph.Get(visual);

            if (thing != null)
            {
                xmlthing = Write(thing);
                xmlthing.Add(new XAttribute("x", visual.Location.X.ToString(CultureInfo.InvariantCulture)));
                xmlthing.Add(new XAttribute("y", visual.Location.Y.ToString(CultureInfo.InvariantCulture)));
                xmlthing.Add(new XAttribute("w", visual.Shape.DataSize.Width.ToString(CultureInfo.InvariantCulture)));
                xmlthing.Add(new XAttribute("h", visual.Shape.DataSize.Height.ToString(CultureInfo.InvariantCulture)));
            }

            return(xmlthing);
        }
Example #3
0
        protected virtual IVisual ReadVisual(XElement node)
        {
            var thing = Read(node);

            this.Things.Add(thing);

            IVisual visual = null;

            if (thing != null)
            {
                visual = VisualThingGraph.Get(thing);
                if (visual != null && Layout != null)
                {
                    Layout.Perform(visual);
                    var x = ReadDouble(node, "x");
                    var y = ReadDouble(node, "y");
                    var w = ReadDouble(node, "w");
                    var h = ReadDouble(node, "h");
                    visual.Shape.Location = new Point(x, y);
                    visual.Shape.DataSize = new Size(w, h);
                }
            }
            return(visual);
        }