ShowDynamicFilters()
{
AssertValid();
if (oNodeXLControl.IsLayingOutGraph || !this.NonEmptyWorkbookRead)
{
return;
}
if (m_oDynamicFilterDialog != null)
{
m_oDynamicFilterDialog.Activate();
return;
}
// The dialog is created on demand.
m_oDynamicFilterDialog = new DynamicFilterDialog(m_oWorkbook);
Int32 iHwnd = m_oWorkbook.Application.Hwnd;
m_oDynamicFilterDialog.DynamicFilterColumnsChanged +=
new DynamicFilterColumnsChangedEventHandler(
m_oDynamicFilterDialog_DynamicFilterColumnsChanged);
m_oDynamicFilterDialog.FilteredAlphaChanged +=
new EventHandler(m_oDynamicFilterDialog_FilteredAlphaChanged);
m_oDynamicFilterDialog.FormClosed += delegate
{
// See the code in ThisWorkbook that opens the
// AutoFillWorkbookDialog for an explanation of why the
// SetForegroundWindow() call is necessary.
Win32Functions.SetForegroundWindow( new IntPtr(iHwnd) );
m_oDynamicFilterDialog = null;
};
// Create a HashSet of edges that have been filtered by edge filters,
// and a HashSet of vertices that have been filtered by vertex filters.
//
// Store the HashSets within the dialog so they are automatically
// destroyed when the dialog is destroyed.
m_oDynamicFilterDialog.Tag = new HashSet<Int32> [] {
new HashSet<Int32>(),
new HashSet<Int32>()
};
m_oDynamicFilterDialog.Show( new Win32Window(iHwnd) );
// If the dialog throws an exception during initialization,
// m_oDynamicFilterDialog gets set to null by the FormClosed delegate
// above.
if (m_oDynamicFilterDialog != null)
{
ReadDynamicFilterColumns(false);
DynamicFilterHandler.ReadFilteredAlpha(m_oDynamicFilterDialog,
oNodeXLControl, true);
UpdateDynamicFiltersLegend();
}
}