protected override void OnWindowRestored(Window window, XElement element)
{
Print("OnWindowRestored for " + window.GetHashCode());
// locate the worksapces "SampleAddOn" elemenet which was created and saved earlier using the OnWindowSaved() method
XElement sampleAddOnElement = element.Element("SampleAddOn");
// do not do anything if that element does not exist
if (sampleAddOnElement == null)
return;
// loop through all the contents of the "SampleAddOn" element
foreach (XElement content in sampleAddOnElement.Elements())
{
// find the "ButtonState" content, restore it's value and set that as our tracked buttonState
if (content.Name == "ButtonState")
{
bool buttonState = false;
bool.TryParse(content.Value, out buttonState);
continue;
}
//Parse additional elements here
}
//Don't forget to call the base OnWindowRestored method after you're done.
base.OnWindowRestored(window, element);