public override void Save(XmlDocument doc, XmlNode node, MpeParser parser, MpeControl reference)
        {
            if (doc != null && node != null)
            {
                base.Save(doc, node, parser, reference);
                //parser.SetValue(doc, node, "animation", Animation.ToString());

                XmlElement mpenode = doc.CreateElement("mpe");
                node.AppendChild(mpenode);

                parser.SetValue(doc, mpenode, "layout", LayoutStyle.ToString());
                parser.SetValue(doc, mpenode, "spring", Spring ? "yes" : "no");
                parser.SetInt(doc, mpenode, "spacing", Spacing);
                parser.SetPadding(doc, mpenode, "padding", Padding);

                if (backImage != null && backImage.Texture != null)
                {
                    XmlElement image = doc.CreateElement("control");
                    backImage.Location = AbsoluteLocation;
                    backImage.Save(doc, image, parser, parser.GetControl(MpeControlType.Image));
                    backImage.Location = Point.Empty;
                    node.AppendChild(image);
                }

                if (reference != null)
                {
                    for (int i = Controls.Count - 1; i >= 0; i--)
                    {
                        if (Controls[i] is MpeControl)
                        {
                            MpeControl control = (MpeControl)Controls[i];
                            try
                            {
                                XmlElement element          = doc.CreateElement("control");
                                MpeControl referenceControl = parser.GetControl(control.Type);
                                control.Save(doc, element, parser, referenceControl);
                                node.AppendChild(element);
                            }
                            catch (Exception e)
                            {
                                MpeLog.Debug(e);
                                MpeLog.Error(e);
                                throw new MpeParserException(e.Message);
                            }
                        }
                    }
                }
            }
        }
Example #2
0
    public override void Save(XmlDocument doc, XmlNode node, MpeParser parser, MpeControl reference)
    {
      if (doc != null && node != null)
      {
        base.Save(doc, node, parser, reference);
        //parser.SetValue(doc, node, "animation", Animation.ToString());

        XmlElement mpenode = doc.CreateElement("mpe");
        node.AppendChild(mpenode);

        parser.SetValue(doc, mpenode, "layout", LayoutStyle.ToString());
        parser.SetValue(doc, mpenode, "spring", Spring ? "yes" : "no");
        parser.SetInt(doc, mpenode, "spacing", Spacing);
        parser.SetPadding(doc, mpenode, "padding", Padding);

        if (backImage != null && backImage.Texture != null)
        {
          XmlElement image = doc.CreateElement("control");
          backImage.Location = AbsoluteLocation;
          backImage.Save(doc, image, parser, parser.GetControl(MpeControlType.Image));
          backImage.Location = Point.Empty;
          node.AppendChild(image);
        }

        if (reference != null)
        {
          for (int i = Controls.Count - 1; i >= 0; i--)
          {
            if (Controls[i] is MpeControl)
            {
              MpeControl control = (MpeControl) Controls[i];
              try
              {
                XmlElement element = doc.CreateElement("control");
                MpeControl referenceControl = parser.GetControl(control.Type);
                control.Save(doc, element, parser, referenceControl);
                node.AppendChild(element);
              }
              catch (Exception e)
              {
                MpeLog.Debug(e);
                MpeLog.Error(e);
                throw new MpeParserException(e.Message);
              }
            }
          }
        }
      }
    }
Example #3
0
 public override void Save(XmlDocument doc, XmlNode node, MpeParser parser, MpeControl reference)
 {
   base.Save(doc, node, parser, reference);
   MpeTextArea textarea = null;
   if (reference != null && reference is MpeTextArea)
   {
     textarea = (MpeTextArea) reference;
   }
   // Label Properties
   Point p = label.AbsoluteLocation;
   parser.SetInt(doc, node, "posX", p.X);
   parser.SetInt(doc, node, "posY", p.Y);
   parser.SetInt(doc, node, "width", label.Width);
   parser.SetInt(doc, node, "height", label.Height);
   parser.SetValue(doc, node, "text", Text);
   if (textarea == null || !textarea.Font.Name.Equals(Font.Name))
   {
     parser.SetValue(doc, node, "font", Font.Name);
   }
   if (textarea == null || textarea.Color != Color)
   {
     parser.SetColor(doc, node, "textcolor", Color);
   }
   if (textarea == null || textarea.DisabledColor != DisabledColor)
   {
     parser.SetColor(doc, node, "disabledcolor", DisabledColor);
   }
   // SpinButton Properties
   p = spinButton.AbsoluteLocation;
   parser.SetInt(doc, node, "SpinPosX", p.X);
   parser.SetInt(doc, node, "SpinPosY", p.Y);
   if (textarea == null || textarea.SpinAlign != SpinAlign)
   {
     parser.SetValue(doc, node, "SpinAlign", SpinAlign.ToString().ToLower());
   }
   if (textarea == null || textarea.SpinSize != SpinSize)
   {
     parser.SetInt(doc, node, "SpinWidth", SpinSize.Width);
     parser.SetInt(doc, node, "SpinHeight", SpinSize.Height);
   }
   if (textarea == null || textarea.SpinColor != SpinColor)
   {
     parser.SetColor(doc, node, "SpinColor", SpinColor);
   }
   if (textarea == null || textarea.TextureUp == null || textarea.TextureUp.Equals(TextureUp) == false)
   {
     if (TextureUp == null)
     {
       parser.SetValue(doc, node, "textureUp", "-");
     }
     else
     {
       parser.SetValue(doc, node, "textureUp", TextureUp.Name);
     }
   }
   if (textarea == null || textarea.TextureUpFocus == null || textarea.TextureUpFocus.Equals(TextureUpFocus) == false
     )
   {
     if (TextureUpFocus == null)
     {
       parser.SetValue(doc, node, "textureUpFocus", "-");
     }
     else
     {
       parser.SetValue(doc, node, "textureUpFocus", TextureUpFocus.Name);
     }
   }
   if (textarea == null || textarea.TextureDown == null || textarea.TextureDown.Equals(TextureDown) == false)
   {
     if (TextureDown == null)
     {
       parser.SetValue(doc, node, "textureDown", "-");
     }
     else
     {
       parser.SetValue(doc, node, "textureDown", TextureDown.Name);
     }
   }
   if (textarea == null || textarea.TextureDownFocus == null ||
       textarea.TextureDownFocus.Equals(TextureDownFocus) == false)
   {
     if (TextureDownFocus == null)
     {
       parser.SetValue(doc, node, "textureDownFocus", "-");
     }
     else
     {
       parser.SetValue(doc, node, "textureDownFocus", TextureDownFocus.Name);
     }
   }
   // Mpe
   if (Spacing != 0 || Padding.None == false)
   {
     XmlElement mpenode = doc.CreateElement("mpe");
     node.AppendChild(mpenode);
     if (Spacing != 0)
     {
       parser.SetInt(doc, mpenode, "spacing", Spacing);
     }
     if (Padding.None == false)
     {
       parser.SetPadding(doc, mpenode, "padding", Padding);
     }
   }
 }
        public override void Save(XmlDocument doc, XmlNode node, MpeParser parser, MpeControl reference)
        {
            base.Save(doc, node, parser, reference);
            MpeTextArea textarea = null;

            if (reference != null && reference is MpeTextArea)
            {
                textarea = (MpeTextArea)reference;
            }
            // Label Properties
            Point p = label.AbsoluteLocation;

            parser.SetInt(doc, node, "posX", p.X);
            parser.SetInt(doc, node, "posY", p.Y);
            parser.SetInt(doc, node, "width", label.Width);
            parser.SetInt(doc, node, "height", label.Height);
            parser.SetValue(doc, node, "text", Text);
            if (textarea == null || !textarea.Font.Name.Equals(Font.Name))
            {
                parser.SetValue(doc, node, "font", Font.Name);
            }
            if (textarea == null || textarea.Color != Color)
            {
                parser.SetColor(doc, node, "textcolor", Color);
            }
            if (textarea == null || textarea.DisabledColor != DisabledColor)
            {
                parser.SetColor(doc, node, "disabledcolor", DisabledColor);
            }
            // SpinButton Properties
            p = spinButton.AbsoluteLocation;
            parser.SetInt(doc, node, "SpinPosX", p.X);
            parser.SetInt(doc, node, "SpinPosY", p.Y);
            if (textarea == null || textarea.SpinAlign != SpinAlign)
            {
                parser.SetValue(doc, node, "SpinAlign", SpinAlign.ToString().ToLower());
            }
            if (textarea == null || textarea.SpinSize != SpinSize)
            {
                parser.SetInt(doc, node, "SpinWidth", SpinSize.Width);
                parser.SetInt(doc, node, "SpinHeight", SpinSize.Height);
            }
            if (textarea == null || textarea.SpinColor != SpinColor)
            {
                parser.SetColor(doc, node, "SpinColor", SpinColor);
            }
            if (textarea == null || textarea.TextureUp == null || textarea.TextureUp.Equals(TextureUp) == false)
            {
                if (TextureUp == null)
                {
                    parser.SetValue(doc, node, "textureUp", "-");
                }
                else
                {
                    parser.SetValue(doc, node, "textureUp", TextureUp.Name);
                }
            }
            if (textarea == null || textarea.TextureUpFocus == null || textarea.TextureUpFocus.Equals(TextureUpFocus) == false
                )
            {
                if (TextureUpFocus == null)
                {
                    parser.SetValue(doc, node, "textureUpFocus", "-");
                }
                else
                {
                    parser.SetValue(doc, node, "textureUpFocus", TextureUpFocus.Name);
                }
            }
            if (textarea == null || textarea.TextureDown == null || textarea.TextureDown.Equals(TextureDown) == false)
            {
                if (TextureDown == null)
                {
                    parser.SetValue(doc, node, "textureDown", "-");
                }
                else
                {
                    parser.SetValue(doc, node, "textureDown", TextureDown.Name);
                }
            }
            if (textarea == null || textarea.TextureDownFocus == null ||
                textarea.TextureDownFocus.Equals(TextureDownFocus) == false)
            {
                if (TextureDownFocus == null)
                {
                    parser.SetValue(doc, node, "textureDownFocus", "-");
                }
                else
                {
                    parser.SetValue(doc, node, "textureDownFocus", TextureDownFocus.Name);
                }
            }
            // Mpe
            if (Spacing != 0 || Padding.None == false)
            {
                XmlElement mpenode = doc.CreateElement("mpe");
                node.AppendChild(mpenode);
                if (Spacing != 0)
                {
                    parser.SetInt(doc, mpenode, "spacing", Spacing);
                }
                if (Padding.None == false)
                {
                    parser.SetPadding(doc, mpenode, "padding", Padding);
                }
            }
        }