void ITabContent.OnVisibilityChanged(TabContentVisibilityEvent visEvent) { #if DEBUG switch (visEvent) { case TabContentVisibilityEvent.Added: Debug.Assert(!_added); Debug.Assert(!_visible); _added = true; break; case TabContentVisibilityEvent.Removed: Debug.Assert(_added); Debug.Assert(!_visible); _added = false; break; case TabContentVisibilityEvent.Visible: Debug.Assert(_added); Debug.Assert(!_visible); _visible = true; break; case TabContentVisibilityEvent.Hidden: Debug.Assert(_added); Debug.Assert(_visible); _visible = false; break; } #endif if (visEvent == TabContentVisibilityEvent.Removed) { Debug.Assert(!removed); CancelAsyncWorker(); elementZoomer.Dispose(); var id = documentTabUIContextLocator as IDisposable; Debug.Assert(id != null); if (id != null) { id.Dispose(); } documentTabService.OnRemoved(this); removed = true; } }
public void OnVisibilityChanged(TabContentVisibilityEvent visEvent) { var ev = Convert(visEvent); if (ev != null) { #if DEBUG switch (ev) { case ToolWindowContentVisibilityEvent.Added: Debug.Assert(!_added); Debug.Assert(!_visible); _added = true; break; case ToolWindowContentVisibilityEvent.Removed: Debug.Assert(_added); Debug.Assert(!_visible); _added = false; break; case ToolWindowContentVisibilityEvent.Visible: Debug.Assert(_added); Debug.Assert(!_visible); _visible = true; break; case ToolWindowContentVisibilityEvent.Hidden: Debug.Assert(_added); Debug.Assert(_visible); _visible = false; break; } #endif if (moving && (visEvent == TabContentVisibilityEvent.Added || visEvent == TabContentVisibilityEvent.Removed)) { // Don't send the Added/Removed events moving = false; } else { Content.OnVisibilityChanged(ev.Value); } } switch (visEvent) { case TabContentVisibilityEvent.Removed: elementZoomer.Dispose(); RemoveEvents(); if (contentPresenter != null) { contentPresenter.Content = null; } contentPresenter = null; OnPropertyChanged(nameof(UIObject)); ContentUIObject = null; break; case TabContentVisibilityEvent.GotKeyboardFocus: IsActive = true; break; case TabContentVisibilityEvent.LostKeyboardFocus: IsActive = false; break; } }