private void TargetColumnChanged(object sender, TargetColumnChangedEventArgs e) { if (e.ExpectedListItemsClass == 0) { return; // no target column selected, so it shouldn't matter what the class of the clerk's list items are. } using (new WaitCursor(this)) { // we're changing the class of our list items. // use ListUpdateHelper to suspend reloading the list until we've changed the class // and recomputed the columns. Otherwise, we'll try to reload the list and redraw the display // with columns that may not have all their parts in place (e.g. for generated custom fields) using (new RecordClerk.ListUpdateHelper(ExistingClerk)) { // change the list items class, but don't do the reload && refresh display // until after we've recomputed our columns to allow regenerating custom field parts // for that new class. ExistingClerk.OnChangeListItemsClass(e.ExpectedListItemsClass, e.TargetFlid, e.ForceReload); CheckExpectedListItemsClassInSync(); // Recompute the possible columns, so the layout/parts system // can generate parts for custom fields based upon a new root object class. // this should not actually change the column specs themselves since // they refer to those parts through "layout" references. m_browseViewer.BrowseView.Vc.ComputePossibleColumns(); } } }
/// ----------------------------------------------------------------------------------- /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged /// resources; <c>false</c> to release only unmanaged resources. /// </param> /// ----------------------------------------------------------------------------------- protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { if (components != null) { components.Dispose(); } if (ExistingClerk != null && !m_haveActiveClerk) { ExistingClerk.BecomeInactive(); } if (m_mediator != null && !m_mediator.IsDisposed) { m_mediator.RemoveColleague(this); } if (m_mpParent != null) { m_mpParent.ShowFirstPaneChanged -= mp_ShowFirstPaneChanged; } } m_mediator = null; m_informationBar = null; // Should be disposed automatically, since it is in the Controls collection. m_mpParent = null; base.Dispose(disposing); }
public TestInterlinMaster(Mediator mediator, IStText stText) { m_mediator = mediator; if (ExistingClerk != null) { System.Diagnostics.Debug.WriteLine("****** Disposing a {0} whose current StText's WS is {1}; replacing with {2}. ******", ExistingClerk.GetType().Name, Cache.ServiceLocator.WritingSystemManager.Get(((IStText)ExistingClerk.CurrentObject).MainWritingSystem).Id, Cache.ServiceLocator.WritingSystemManager.Get(stText.MainWritingSystem).Id); ExistingClerk.Dispose(); } Clerk = new TestClerk(mediator, stText); }