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; } }
static ToolWindowContentVisibilityEvent?Convert(TabContentVisibilityEvent ev) { switch (ev) { case TabContentVisibilityEvent.Added: return(ToolWindowContentVisibilityEvent.Added); case TabContentVisibilityEvent.Removed: return(ToolWindowContentVisibilityEvent.Removed); case TabContentVisibilityEvent.Visible: return(ToolWindowContentVisibilityEvent.Visible); case TabContentVisibilityEvent.Hidden: return(ToolWindowContentVisibilityEvent.Hidden); case TabContentVisibilityEvent.GotKeyboardFocus: return(ToolWindowContentVisibilityEvent.GotKeyboardFocus); case TabContentVisibilityEvent.LostKeyboardFocus: return(ToolWindowContentVisibilityEvent.LostKeyboardFocus); default: Debug.Fail(string.Format("Unknown event: {0}", ev)); return(null); } }
static ToolWindowContentVisibilityEvent? Convert(TabContentVisibilityEvent ev) { switch (ev) { case TabContentVisibilityEvent.Added: return ToolWindowContentVisibilityEvent.Added; case TabContentVisibilityEvent.Removed: return ToolWindowContentVisibilityEvent.Removed; case TabContentVisibilityEvent.Visible: return ToolWindowContentVisibilityEvent.Visible; case TabContentVisibilityEvent.Hidden: return ToolWindowContentVisibilityEvent.Hidden; case TabContentVisibilityEvent.GotKeyboardFocus: return ToolWindowContentVisibilityEvent.GotKeyboardFocus; case TabContentVisibilityEvent.LostKeyboardFocus: return ToolWindowContentVisibilityEvent.LostKeyboardFocus; default: Debug.Fail(string.Format("Unknown event: {0}", ev)); return null; } }
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: RemoveEvents(); if (contentPresenter != null) contentPresenter.Content = null; contentPresenter = null; OnPropertyChanged("UIObject"); ContentUIObject = null; break; case TabContentVisibilityEvent.GotKeyboardFocus: IsActive = true; break; case TabContentVisibilityEvent.LostKeyboardFocus: IsActive = false; break; } }
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) { CancelAsyncWorker(); elementScaler.Dispose(); var id = fileTabUIContextLocator as IDisposable; Debug.Assert(id != null); if (id != null) id.Dispose(); fileTabManager.OnRemoved(this); } }
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; } }