public XmlElement GenerateXmlElement(XmlDocument doc)
        {
            var node = doc.CreateElement("Viewport");

            node.SetAttribute("Index", ScreenIndex.ToString());
            node.SetAttribute("Name", Name);
            if (!IsVisible)
            {
                node.SetAttribute("IsVisible", IsVisible.ToString());
            }
            node.SetAttribute("TimeLength", TimeLength.ToString());
            node.SetAttribute("SwitchMode", SwitchMode.ToString());
            node.SetAttribute("SwitchHotKey", SwitchHotKey.ToString());
            if (ElementsCaptionColor != System.Drawing.Color.White)
            {
                node.SetAttribute("ElementsCaptionColor", ElementsCaptionColor.ToArgb().ToString());
            }
            if (ElementsCaptionScale != 1)
            {
                node.SetAttribute("ElementsCaptionScale", ElementsCaptionScale.ToString());
            }
            foreach (var elm in Elements)
            {
                if (elm == null)
                {
                    continue;
                }
                if (elm.Resource != null && elm.Resource.FullFilePath == ResourceInfo_BackgroundImage.DefaultBackgroundImageFile)
                {
                    continue;
                }
                var enode = elm.GenerateXmlElement(doc);
                node.AppendChild(enode);
            }
            var gnode = ElemGroupCollector.GenerateXmlElement(doc);

            if (gnode != null)
            {
                node.AppendChild(gnode);
            }
            return(node);
        }
 public override int GetHashCode()
 {
     return((Code + SwitchMode.ToString("G")).GetHashCode());
 }