Exemple #1
0
        public override void ReadXml(XmlReader reader)
        {
            TypeConverter boolConverter  = TypeDescriptor.GetConverter(typeof(bool));
            TypeConverter sizeConverter  = TypeDescriptor.GetConverter(typeof(Size));
            TypeConverter pointConverter = TypeDescriptor.GetConverter(typeof(Point));

            if (reader.Name.Equals("Location"))
            {
                Point location = (Point)pointConverter.ConvertFromString(null, System.Globalization.CultureInfo.InvariantCulture, reader.ReadElementString("Location"));
                Left = location.X;
                Top  = location.Y;

                Size size = (Size)sizeConverter.ConvertFromString(null, System.Globalization.CultureInfo.InvariantCulture, reader.ReadElementString("Size"));
                Width  = size.Width;
                Height = size.Height;
            }
            if (reader.Name.Equals("Rotation"))
            {
                Rotation = (HeliosVisualRotation)Enum.Parse(typeof(HeliosVisualRotation), reader.ReadElementString("Rotation"));
            }
            if (reader.Name.Equals("Hidden"))
            {
                IsDefaultHidden = (bool)boolConverter.ConvertFromInvariantString(reader.ReadElementString("Hidden"));
                IsHidden        = IsDefaultHidden;
            }
        }
Exemple #2
0
        public override void ReadXml(XmlReader reader)
        {
            TypeConverter boolConverter = TypeDescriptor.GetConverter(typeof(bool));
            TypeConverter sizeConverter = TypeDescriptor.GetConverter(typeof(Size));
            TypeConverter pointConverter = TypeDescriptor.GetConverter(typeof(Point));

            if (reader.Name.Equals("Location"))
            {
                Point location = (Point)pointConverter.ConvertFromString(null, System.Globalization.CultureInfo.InvariantCulture, reader.ReadElementString("Location"));
                Left = location.X;
                Top = location.Y;

                Size size = (Size)sizeConverter.ConvertFromString(null, System.Globalization.CultureInfo.InvariantCulture, reader.ReadElementString("Size"));
                Width = size.Width;
                Height = size.Height;
            }
            if (reader.Name.Equals("Rotation"))
            {
                Rotation = (HeliosVisualRotation)Enum.Parse(typeof(HeliosVisualRotation), reader.ReadElementString("Rotation"));
            }
            if (reader.Name.Equals("Hidden"))
            {
                IsDefaultHidden = (bool)boolConverter.ConvertFromInvariantString(reader.ReadElementString("Hidden"));
                IsHidden = IsDefaultHidden;
            }
        }