Example #1
0
			private static bool TryGetSettingsForCurrentTabPage(BulkEditBar bulkEditBar, out BulkEditTabPageSettings tabPageSettings)
			{
				string currentTabSettingsKey = BuildCurrentTabSettingsKey(bulkEditBar);
				tabPageSettings = DeserializeTabPageSettings(bulkEditBar, currentTabSettingsKey);
				return tabPageSettings.AreLoaded;
			}
Example #2
0
			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;
			}
Example #3
0
			static internal BulkEditTabPageSettings GetNewSettingsForSelectedTab(BulkEditBar bulkEditBar)
			{
				BulkEditTabPageSettings tabPageSettings = null;
				switch (bulkEditBar.m_operationsTabControl.SelectedIndex)
				{
					default:
						// by default, just save basic tab info.
						tabPageSettings = new BulkEditTabPageSettings();
						break;
					case (int)BulkEditBarTabs.ListChoice: // list
						tabPageSettings = new ListChoiceTabPageSettings();
						break;
					case (int)BulkEditBarTabs.BulkCopy: // bulk copy
						tabPageSettings = new BulkCopyTabPageSettings();
						break;
					case (int)BulkEditBarTabs.ClickCopy: // click copy
						tabPageSettings = new ClickCopyTabPageSettings();
						break;
					case (int)BulkEditBarTabs.Process: // transduce
						tabPageSettings = new ProcessTabPageSettings();
						break;
					case (int)BulkEditBarTabs.BulkReplace: // find/replace
						tabPageSettings = new BulkReplaceTabPageSettings();
						break;
					case (int)BulkEditBarTabs.Delete: // Delete.
						tabPageSettings = new DeleteTabPageSettings();
						break;
				}
				tabPageSettings.m_bulkEditBar = bulkEditBar;
				return tabPageSettings;
			}