Example #1
0
 public void SerializeControls(HeliosVisualCollection controls, XmlWriter xmlWriter)
 {
     xmlWriter.WriteStartElement("Children");
     foreach (HeliosVisual control in controls)
     {
         SerializeControl(control, xmlWriter);
     }
     xmlWriter.WriteEndElement();  // Controls
 }
Example #2
0
 public IEnumerable <string> DeserializeControls(HeliosVisualCollection controls, XmlReader xmlReader)
 {
     if (!xmlReader.IsEmptyElement)
     {
         xmlReader.ReadStartElement("Children");
         while (xmlReader.NodeType != XmlNodeType.EndElement)
         {
             foreach (string progress in DeserializeControl(controls, xmlReader))
             {
                 yield return(progress);
             }
         }
         xmlReader.ReadEndElement();
     }
     else
     {
         xmlReader.Read();
     }
 }
Example #3
0
        public IEnumerable <string> DeserializeControl(HeliosVisualCollection controls, XmlReader xmlReader)
        {
            TypeConverter boolConverter = TypeDescriptor.GetConverter(typeof(bool));

            HeliosVisual control = (HeliosVisual)CreateNewObject("Visual", xmlReader.GetAttribute("TypeIdentifier"));

            if (control != null)
            {
                string name = xmlReader.GetAttribute("Name");
                if (xmlReader.GetAttribute("SnapTarget") != null)
                {
                    control.IsSnapTarget = (bool)boolConverter.ConvertFromInvariantString(xmlReader.GetAttribute("SnapTarget"));
                }
                if (xmlReader.GetAttribute("Locked") != null)
                {
                    control.IsLocked = (bool)boolConverter.ConvertFromInvariantString(xmlReader.GetAttribute("Locked"));
                }

                if (xmlReader.IsEmptyElement)
                {
                    xmlReader.Read();
                }
                else
                {
                    xmlReader.ReadStartElement("Control");
                    control.ReadXml(xmlReader);
                    foreach (string progress in DeserializeControls(control.Children, xmlReader))
                    {
                        yield return(progress);
                    }
                    ;
                    xmlReader.ReadEndElement();
                }
                control.Name = name;
                controls.Add(control);
                yield return($"loaded {control.TypeIdentifier}");
            }
            else
            {
                xmlReader.Skip();
                yield return("failed to load a control");
            }
        }
Example #4
0
 public void DeserializeControls(HeliosVisualCollection controls, XmlReader xmlReader)
 {
     if (!xmlReader.IsEmptyElement)
     {
         xmlReader.ReadStartElement("Children");
         while (xmlReader.NodeType != XmlNodeType.EndElement)
         {
             HeliosVisual control = DeserializeControl(xmlReader);
             if (control != null)
             {
                 controls.Add(control);
             }
         }
         xmlReader.ReadEndElement();
     }
     else
     {
         xmlReader.Read();
     }
 }
Example #5
0
        /// <summary>
        /// Base constructor for a HeliosVisual.
        /// </summary>
        /// <param name="name">Default name for this object.</param>
        /// <param name="nativeSize">Native size that this control renderes at.</param>
        protected HeliosVisual(string name, Size nativeSize)
            : base(name)
        {
            _rectangle  = new Rect(nativeSize);
            _nativeSize = nativeSize;
            UpdateRectangle();

            _children = new HeliosVisualCollection();

            HeliosAction toggleVisibleAction = new HeliosAction(this, "", "hidden", "toggle", "Toggles whether this control is displayed on screen.");

            toggleVisibleAction.Execute += new HeliosActionHandler(ToggleVisibleAction_Execute);
            Actions.Add(toggleVisibleAction);

            _hiddenValue          = new HeliosValue(this, new BindingValue(false), "", "hidden", "Indicates if this control is hidden and off screen.", "True if this panel is not displayed.", BindingValueUnits.Boolean);
            _hiddenValue.Execute += new HeliosActionHandler(SetHiddenAction_Execute);
            Values.Add(_hiddenValue);
            Actions.Add(_hiddenValue);

            Children.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Children_CollectionChanged);
        }