SIL.FieldWorks.Common.Controls.BulkEditBar.BulkEditTabPageSettings.TrySwitchToLastSavedTab C# (CSharp) Method

TrySwitchToLastSavedTab() static private method

Restore last visited BulkEditBar tab index. After BulkEditBar finishes initializing its state and controls in that tab, finish restoring the settings in that tab with InitializeSelectedTab()
static private TrySwitchToLastSavedTab ( BulkEditBar bulkEditBar ) : bool
bulkEditBar BulkEditBar
return bool
			static internal bool TrySwitchToLastSavedTab(BulkEditBar bulkEditBar)
			{
				BulkEditTabPageSettings settings;
				// first try to deserialize stored settings.
				settings = BulkEditTabPageSettings.DeserializeLastTabPageSettings(bulkEditBar);
				// get the name of the tab. if we can't get this, no point in continuing to use the settings,
				// because all other settings depend upon the tab.
				if (settings.AreLoaded)
				{
					bool fOk = true;
					// try switching to saved tab.
					try
					{
						BulkEditBarTabs tab = (BulkEditBarTabs)Enum.Parse(typeof(BulkEditBarTabs), settings.TabPageName);
						bulkEditBar.m_operationsTabControl.SelectedIndex = (int)tab;
					}
					catch
					{
						// something went wrong trying to restore tab, so assume we didn't switch to a saved one.
						fOk = false;
					}
					return fOk;
				}
				return false;
			}