public override void LoadElementFromXml(XmlReader xmlReader, KryptonPageCollection pages)
{
// Is it the expected xml element name?
if (xmlReader.Name != XmlElementName)
throw new ArgumentException("Element name '" + XmlElementName + "' was expected but found '" + xmlReader.Name + "' instead.");
// Grab the element attributes
string elementName = xmlReader.GetAttribute("N");
string elementOrder = xmlReader.GetAttribute("O");
string elementSize = xmlReader.GetAttribute("S");
// Check the name matches up
if (elementName != Name)
throw new ArgumentException("Attribute 'N' value '" + Name + "' was expected but found '" + elementName + "' instead.");
// Check for the optional element order value
if (!string.IsNullOrEmpty(elementOrder))
Order = int.Parse(elementOrder);
else
Order = -1;
// Check for the optional element size value
if (!string.IsNullOrEmpty(elementSize))
LoadSize = CommonHelper.StringToSize(elementSize);
else
LoadSize = Size.Empty;
// Read to the expect child element
if (!xmlReader.Read())
throw new ArgumentException("An element was expected but could not be read in.");
// This should always be a workspace definition
if (xmlReader.Name != "KW")
throw new ArgumentException("Element name 'KW' was expected but found '" + xmlReader.Name + "' instead.");
// Let derived class perform element specific persistence
LoadDockingElement(xmlReader, pages);
// Read past this element to the end element
if (!xmlReader.Read())
throw new ArgumentException("An element was expected but could not be read in.");
}