/// <summary> /// This reads and sets its state or attributes stored in a <c>XML</c> format /// with the given reader. /// </summary> /// <param name="reader"> /// The reader with which the <c>XML</c> attributes of this object are accessed. /// </param> /// <exception cref="ArgumentNullException"> /// If the <paramref name="reader"/> is <see langword="null"/>. /// </exception> public override void ReadXml(XmlReader reader) { BuildExceptions.NotNull(reader, "reader"); Debug.Assert(reader.NodeType == XmlNodeType.Element); if (reader.NodeType != XmlNodeType.Element) { return; } if (!String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase)) { return; } _href = reader.GetAttribute("href"); _title = reader.GetAttribute("title"); _altText = reader.GetAttribute("alt"); _shape = MediaImageAreaShape.Default; string nodeText = reader.GetAttribute("shape"); switch (nodeText.ToLower()) { case "default": _shape = MediaImageAreaShape.Default; break; case "circ": case "circle": _shape = MediaImageAreaShape.Circle; break; case "rect": case "rectangle": _shape = MediaImageAreaShape.Rectangle; break; case "poly": case "polygon": _shape = MediaImageAreaShape.Polygon; break; } nodeText = reader.GetAttribute("coords"); if (!String.IsNullOrEmpty(nodeText)) { string[] texts = nodeText.Split(','); if (texts != null && texts.Length > 1) { _coordinates = new List <int>(texts.Length); for (int i = 0; i < texts.Length; i++) { _coordinates.Add(Convert.ToInt32(texts[i].Trim())); } } } }
/// <overloads> /// Initializes a new instance of the <see cref="MediaImageArea"/> class. /// </overloads> /// <summary> /// Initializes a new instance of the <see cref="MediaImageArea"/> class /// to the default properties or values. /// </summary> public MediaImageArea() { _shape = MediaImageAreaShape.Default; _title = String.Empty; _altText = String.Empty; _href = String.Empty; _coordinates = new List <int>(); }
/// <summary> /// Initializes a new instance of the <see cref="MediaImageArea"/> class /// with initial parameters copied from the specified instance of the /// specified <see cref="MediaImageArea"/> class, a copy constructor. /// </summary> /// <param name="source"> /// An instance of the <see cref="MediaImageArea"/> class from which the /// initialization parameters or values will be copied. /// </param> /// <exception cref="ArgumentNullException"> /// If the parameter <paramref name="source"/> is <see langword="null"/>. /// </exception> public MediaImageArea(MediaImageArea source) : base(source) { _title = source._title; _href = source._href; _altText = source._altText; _shape = source._shape; _coordinates = source._coordinates; }