/// <summary> /// The logic used whenever a dependent locator is swapped. /// </summary> /// <param name="newLocator">The new locator.</param> /// <param name="oldLocator">The old locator.</param> /// <param name="token">The token to use to lock.</param> protected void ProcessLocatorSwap(ILocator newLocator, ILocator oldLocator, object token) { if (oldLocator != null) { Locators.Remove(oldLocator); oldLocator.SearchToBegin -= Locator_SearchToBegin; oldLocator.SearchComplete -= Locator_SearchComplete; oldLocator.RecordRequested -= Locator_RecordRequested; } if (newLocator != null) { Locators.Add(newLocator); newLocator.RequestClear(); newLocator.RequestDisable(token); newLocator.SearchToBegin += Locator_SearchToBegin; newLocator.SearchComplete += Locator_SearchComplete; newLocator.RecordRequested += Locator_RecordRequested; } }