Example #1
0
        public MacroPanelElement AddElement()
        {
            MacroPanelElement newElement = new MacroPanelElement();

            newElement.Parent = this;
            elements.Add(newElement);
            return(newElement);
        }
Example #2
0
 public void RemoveElement(MacroPanelElement element)
 {
     if (!elements.Contains(element))
     {
         return;
     }
     elements.Remove(element);
     element.Parent = null;
 }
        public XElement SerializeItem(object item, object parentItem)
        {
            MacroPanelElement element = item as MacroPanelElement;

            if (element == null)
            {
                return(null);
            }

            XElement xmlElement = new XElement(TAG_NAME);

            xmlElement.SetAttributeValue(ATTRIBUTE_MACRO, element.Macro?.ID);
            xmlElement.SetAttributeValue(ATTRIBUTE_LABEL, element.Label ?? "");
            xmlElement.SetAttributeValue(ATTRIBUTE_SHOWLABEL, (element.ShowLabel ? "true" : "false"));
            xmlElement.SetAttributeValue(ATTRIBUTE_BACKCOLOR, ColorToHexString(element.BackColor));
            xmlElement.SetAttributeValue(ATTRIBUTE_FORECOLOR, ColorToHexString(element.ForeColor));
            xmlElement.SetAttributeValue(ATTRIBUTE_X, element.PositionX);
            xmlElement.SetAttributeValue(ATTRIBUTE_Y, element.PositionY);
            xmlElement.SetAttributeValue(ATTRIBUTE_W, element.SizeW);
            xmlElement.SetAttributeValue(ATTRIBUTE_H, element.SizeH);

            return(xmlElement);
        }