static private BulkEditTabPageSettings DeserializeTabPageSettings(BulkEditBar bulkEditBar, string tabSettingsKey)
{
Mediator mediator = bulkEditBar.m_mediator;
string settingsXml = "";
if (tabSettingsKey.Length > 0)
settingsXml = mediator.PropertyTable.GetStringProperty(tabSettingsKey, "", PropertyTable.SettingsGroup.LocalSettings);
BulkEditTabPageSettings restoredTabPageSettings = null;
if (settingsXml.Length > 0)
{
// figure out type/class of object to deserialize from xml data.
XmlDocument doc = new XmlDocument();
doc.LoadXml(settingsXml);
string className = doc.DocumentElement.Name;
// get the type from the xml itself.
Assembly assembly = Assembly.GetExecutingAssembly();
// if we can find an existing class/type, we can try to deserialize to it.
BulkEditTabPageSettings basicTabPageSettings = new BulkEditTabPageSettings();
Type pgSettingsType = basicTabPageSettings.GetType();
string baseClassTypeName = pgSettingsType.FullName.Split(new char[] { '+' })[0];
Type targetType = assembly.GetType(baseClassTypeName + "+" + className, false);
// deserialize
restoredTabPageSettings = (BulkEditTabPageSettings)
XmlUtils.DeserializeXmlString(settingsXml, targetType);
}
if (restoredTabPageSettings == null)
restoredTabPageSettings = new BulkEditTabPageSettings();
restoredTabPageSettings.m_bulkEditBar = bulkEditBar;
return restoredTabPageSettings;
}