public MpeContainer(MpeContainer container) : base(container) { MpeLog.Debug("MpeContainer(container)"); backImage = new MpeImage(container.backImage); layoutStyle = container.layoutStyle; gridSize = container.gridSize; showGrid = container.showGrid; showBorder = container.showBorder; snapToGrid = container.snapToGrid; spring = container.spring; spacing = container.spacing; for (int i = 0; i < container.Controls.Count; i++) { if (container.Controls[i] is MpeControl) { MpeControl c = (MpeControl) container.Controls[i]; if (c.Embedded == false) { Controls.Add(c.Copy()); } } } }
public MpeContainer(MpeContainer container) : base(container) { MpeLog.Debug("MpeContainer(container)"); backImage = new MpeImage(container.backImage); layoutStyle = container.layoutStyle; gridSize = container.gridSize; showGrid = container.showGrid; showBorder = container.showBorder; snapToGrid = container.snapToGrid; spring = container.spring; spacing = container.spacing; for (int i = 0; i < container.Controls.Count; i++) { if (container.Controls[i] is MpeControl) { MpeControl c = (MpeControl)container.Controls[i]; if (c.Embedded == false) { Controls.Add(c.Copy()); } } } }
public virtual void Load(XPathNodeIterator iterator, MpeParser parser) { MpeLog.Debug("MpeControl.Load()"); this.parser = parser; if (iterator != null) { // First load tags XPathNodeIterator i = iterator.Current.SelectChildren("", ""); while (i.MoveNext()) { if (i.Current.Name != null && i.Current.Value != null) { XPathNodeIterator ci = i.Current.SelectChildren("", ""); if (ci.Count == 0) { if (i.Current.Name == "animation") { int pos = -1; switch (i.Current.Value) { case "WindowOpen": pos = 0; break; case "WindowClose": pos = 1; break; case "Hidden": pos = 2; break; case "Focus": pos = 3; break; case "Unfocus": pos = 4; break; case "VisibleChange": pos = 5; break; } if (pos >= 0) { Animation.Animation[pos].Enabled = true; string efect = i.Current.GetAttribute("effect", String.Empty); switch (efect) { case "fade": Animation.Animation[pos].Efect = MpeAnimationEfect.fade; break; case "slide": Animation.Animation[pos].Efect = MpeAnimationEfect.slide; break; case "rotate": Animation.Animation[pos].Efect = MpeAnimationEfect.rotate; break; case "rotatex": Animation.Animation[pos].Efect = MpeAnimationEfect.rotatex; break; case "rotatey": Animation.Animation[pos].Efect = MpeAnimationEfect.rotatey; break; case "zoom": Animation.Animation[pos].Efect = MpeAnimationEfect.zoom; break; } int parami = 0; bool paramb = false; int.TryParse(i.Current.GetAttribute("time", String.Empty), out parami); Animation.Animation[pos].Time = parami; parami = 0; int.TryParse(i.Current.GetAttribute("delay", String.Empty), out parami); Animation.Animation[pos].Delay = parami; Animation.Animation[pos].Start = i.Current.GetAttribute("start", String.Empty); Animation.Animation[pos].End = i.Current.GetAttribute("end", String.Empty); parami = 0; int.TryParse(i.Current.GetAttribute("acceleration", String.Empty), out parami); Animation.Animation[pos].Acceleration = parami; string center = i.Current.GetAttribute("center", String.Empty); if (center.Contains(",")) { int.TryParse(center.Substring(0, center.IndexOf(',')), out parami); int paramy = 0; int.TryParse(center.Substring(center.IndexOf(',') + 1), out paramy); Animation.Animation[pos].Center = new Point(parami, paramy); } Animation.Animation[pos].Condition = i.Current.GetAttribute("condition", String.Empty); bool.TryParse(i.Current.GetAttribute("reversible", String.Empty), out paramb); Animation.Animation[pos].Reversible = paramb; paramb = false; bool.TryParse(i.Current.GetAttribute("pulse", String.Empty), out paramb); Animation.Animation[pos].Pulse = paramb; switch (i.Current.GetAttribute("tween", String.Empty)) { case "elastic": Animation.Animation[pos].Tween = MpeAnimationTween.elastic; break; case "bounce": Animation.Animation[pos].Tween = MpeAnimationTween.bounce; break; case "circle": Animation.Animation[pos].Tween = MpeAnimationTween.circle; break; case "back": Animation.Animation[pos].Tween = MpeAnimationTween.back; break; case "sine": Animation.Animation[pos].Tween = MpeAnimationTween.sine; break; case "cubic": Animation.Animation[pos].Tween = MpeAnimationTween.cubic; break; case "quadratic": Animation.Animation[pos].Tween = MpeAnimationTween.quadratic; break; case "linear": Animation.Animation[pos].Tween = MpeAnimationTween.linear; break; } switch (i.Current.GetAttribute("easing", String.Empty)) { case "out": Animation.Animation[pos].Easing = MpeAnimationEasing.Out; break; case "in": Animation.Animation[pos].Easing = MpeAnimationEasing.In; break; case "inout": Animation.Animation[pos].Easing = MpeAnimationEasing.inout; break; } } } else { tags.Add(i.Current.Name, i.Current.Value, false); } } } } tags.Remove("type"); Id = parser.GetInt(iterator, "id", Id); tags.Remove("id"); Description = parser.GetString(iterator, "description", Description); tags.Remove("description"); // The position must be converted from absolute to relative int x = parser.GetInt(iterator, "posX", Left); int y = parser.GetInt(iterator, "posY", Top); MpeContainer c = MpeParent; while (c != null && c.Type != MpeControlType.Screen) { x -= c.Left; y -= c.Top; c = c.MpeParent; } Left = x; Top = y; tags.Remove("posX"); tags.Remove("posY"); // Load the rest of the properties Width = parser.GetInt(iterator, "width", Width); tags.Remove("width"); Height = parser.GetInt(iterator, "height", Height); tags.Remove("height"); Padding = parser.GetPadding(iterator, "padding", Padding); Visible = parser.GetString(iterator, "visible", Visible); tags.Remove("visible"); DiffuseColor = parser.GetColor(iterator, "colordiffuse", DiffuseColor); tags.Remove("colordiffuse"); DimColor = parser.GetColor(iterator, "dimColor", DimColor); tags.Remove("dimColor"); OnLeft = parser.GetInt(iterator, "onleft", OnLeft); tags.Remove("onleft"); OnRight = parser.GetInt(iterator, "onright", OnRight); tags.Remove("onright"); OnUp = parser.GetInt(iterator, "onup", OnUp); tags.Remove("onup"); OnDown = parser.GetInt(iterator, "ondown", OnDown); tags.Remove("ondown"); } if (reference) { Id = 1; } }