/// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { if (disposing) { UnsubscribeToGridEvents(); if (ContextMenuStrip != null && !ContextMenuStrip.IsDisposed) { ContextMenuStrip.Opening -= ContextMenuStrip_Opening; } App.RemoveMediatorColleague(this); if (!CIEOptionsButton.IsDisposed) { CIEOptionsButton.Dispose(); } if (!CIESimilarOptionsButton.IsDisposed) { CIESimilarOptionsButton.Dispose(); } if (m_image != null) { m_image.Dispose(); m_image = null; } if (m_resultView != null) { m_resultView.Dispose(); m_resultView = null; } if (m_btnClose != null) { var frm = FindForm(); if (frm != null) { frm.Controls.Remove(m_btnClose); } m_btnClose.Dispose(); m_btnClose = null; } SearchQuery = null; } base.Dispose(disposing); }
/// ------------------------------------------------------------------------------------ public SearchResultTab AddTab(SearchResultView resultView) { if (m_tabsPanel.Left > 0) { m_tabsPanel.Left = 0; } SearchResultTab tab = new SearchResultTab(this); tab.ResultView = resultView; AddTab(tab); return(tab); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Removes the tab's result view. /// </summary> /// ------------------------------------------------------------------------------------ public void RemoveResultView() { if (m_resultView != null) { UnsubscribeToGridEvents(); if (OwningTabGroup != null && OwningTabGroup.Controls.Contains(m_resultView)) { OwningTabGroup.Controls.Remove(m_resultView); } m_resultView.Dispose(); m_resultView = null; } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes the specified tab with the specified text and result view. /// </summary> /// ------------------------------------------------------------------------------------ public void InitializeTab(SearchResultTab tab, SearchResultView resultView, bool removePreviousResults) { if (tab == null) { return; } bool viewWasInCIEView = tab.CIEOptionsButton.Visible; bool viewWasInCIESimilarView = tab.CIESimilarOptionsButton.Visible; // Make sure that if tab already has a result view, it gets removed. if (removePreviousResults) { tab.RemoveResultView(); } // If there is no tab text, then get it from the result view's search query. if (tab.GetDoesHaveEmptyText() && resultView != null && resultView.SearchQuery != null) { tab.Text = resultView.SearchQuery.ToString(); } tab.AdjustWidth(); tab.OwningTabGroup = this; if (resultView != null) { tab.ResultView = resultView; tab.ResultView.Size = new Size(Width, Height - TabsContainer.Height); tab.ResultView.Click += HandleClick; tab.ResultView.MouseDown += HandleMouseDown; Controls.Add(resultView); AdjustTabContainerWidth(); resultView.BringToFront(); if (viewWasInCIEView) { tab.CIEViewRefresh(); } if (viewWasInCIESimilarView) { tab.CIEViewSimilarRefresh(); } } }