//************************************************************************* // Method: m_oDynamicFilterDialog_FormClosed() // /// <summary> /// Handles the FormClosed event on the m_oDynamicFilterDialog. /// </summary> /// /// <param name="sender"> /// Standard event argument. /// </param> /// /// <param name="e"> /// Standard event argument. /// </param> //************************************************************************* protected void m_oDynamicFilterDialog_FormClosed( Object sender, FormClosedEventArgs e ) { AssertValid(); m_oDynamicFilterDialog = null; }
//************************************************************************* // Method: ShowDynamicFilters() // /// <summary> /// Shows the dynamic filters dialog. /// </summary> //************************************************************************* private void ShowDynamicFilters() { AssertValid(); if (oNodeXLControl.IsLayingOutGraph || !this.NonEmptyWorkbookRead) { return; } if (m_oDynamicFilterDialog == null) { // The dialog is created on demand. m_oDynamicFilterDialog = new DynamicFilterDialog(m_oWorkbook); m_oDynamicFilterDialog.DynamicFilterColumnsChanged += new DynamicFilterColumnsChangedEventHandler( m_oDynamicFilterDialog_DynamicFilterColumnsChanged); m_oDynamicFilterDialog.FilteredAlphaChanged += new EventHandler(m_oDynamicFilterDialog_FilteredAlphaChanged); m_oDynamicFilterDialog.FormClosed += new FormClosedEventHandler( m_oDynamicFilterDialog_FormClosed); // Create a dictionary of edges that have been filtered by edge // filters, and a dictionary of vertices that have been filtered by // vertex filters. // // The key is the IEdge.ID or IVertex.ID and the value isn't used. // Store the dictionaries within the dialog so they are // automatically destroyed when the dialog is destroyed. m_oDynamicFilterDialog.Tag = new Dictionary<Int32, Char> [] { new Dictionary<Int32, Char>(), new Dictionary<Int32, Char>() }; m_oDynamicFilterDialog.Show(this); // If the dialog throws an exception during initialization, // m_oDynamicFilterDialog gets set to null by // m_oDynamicFilterDialog_FormClosed(). if (m_oDynamicFilterDialog != null) { ReadDynamicFilterColumns(false); ReadFilteredAlpha(true); UpdateDynamicFiltersLegend(); } } else { m_oDynamicFilterDialog.Activate(); } }
//************************************************************************* // Constructor: TaskPane() // /// <summary> /// Initializes a new instance of the <see cref="TaskPane" /> class. /// </summary> /// /// <param name="thisWorkbook"> /// The workbook. /// </param> /// /// <param name="ribbon"> /// The application's ribbon. /// </param> //************************************************************************* public TaskPane( ThisWorkbook thisWorkbook, Ribbon ribbon ) { Debug.Assert(thisWorkbook != null); Debug.Assert(ribbon != null); InitializeComponent(); m_oWorkbook = thisWorkbook.InnerObject; m_oRibbon = ribbon; // The WpfImageUtil uses the screen DPI in its image handling. Graphics oGraphics = this.CreateGraphics(); WpfImageUtil.ScreenDpi = oGraphics.DpiX; oGraphics.Dispose(); // Get the template version from the per-workbook settings. PerWorkbookSettings oPerWorkbookSettings = this.PerWorkbookSettings; m_iTemplateVersion = oPerWorkbookSettings.TemplateVersion; m_bHandlingLayoutChanged = false; m_iEnableGraphControlsCount = 0; m_oEdgeRowIDDictionary = null; m_oVertexRowIDDictionary = null; m_oSaveGraphImageFileDialog = null; m_oDynamicFilterDialog = null; GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings(); LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings(); LayoutType eInitialLayout = oLayoutUserSettings.Layout; // Instantiate an object that populates the sbLayout // ToolStripSplitButton and handles its LayoutChanged event. m_oLayoutManagerForToolStripSplitButton = new LayoutManagerForToolStripSplitButton(); m_oLayoutManagerForToolStripSplitButton.AddItems(this.sbLayout); m_oLayoutManagerForToolStripSplitButton.Layout = eInitialLayout; // Instantiate an object that populates the msiContextLayout // context menu and handles the Clicked events on the child menu items. m_oLayoutManagerForContextMenu = new LayoutManagerForMenu(); m_oLayoutManagerForContextMenu.AddMenuItems(this.msiContextLayout); m_oLayoutManagerForContextMenu.Layout = eInitialLayout; m_oLayoutManagerForToolStripSplitButton.LayoutChanged += new EventHandler(this.LayoutManager_LayoutChanged); m_oLayoutManagerForContextMenu.LayoutChanged += new EventHandler(this.LayoutManager_LayoutChanged); thisWorkbook.VisualAttributeSetInWorkbook += new EventHandler(ThisWorkbook_VisualAttributeSetInWorkbook); thisWorkbook.CollapseOrExpandGroups += new CollapseOrExpandGroupsEventHandler( ThisWorkbook_CollapseOrExpandGroups); thisWorkbook.WorksheetContextMenuManager.RequestVertexCommandEnable += new RequestVertexCommandEnableEventHandler( WorksheetContextMenuManager_RequestVertexCommandEnable); thisWorkbook.WorksheetContextMenuManager.RequestEdgeCommandEnable += new RequestEdgeCommandEnableEventHandler( WorksheetContextMenuManager_RequestEdgeCommandEnable); thisWorkbook.WorksheetContextMenuManager.RunVertexCommand += new RunVertexCommandEventHandler( WorksheetContextMenuManager_RunVertexCommand); thisWorkbook.WorksheetContextMenuManager.RunEdgeCommand += new RunEdgeCommandEventHandler( WorksheetContextMenuManager_RunEdgeCommand); // There is no Closing event on the TaskPane and no parent form whose // Closing event can be handled. Instead, using the Shutdown event on // the workbook to perform closing tasks. thisWorkbook.Shutdown += new EventHandler(ThisWorkbook_Shutdown); m_oRibbon.Layout = eInitialLayout; m_oRibbon.RibbonControlsChanged += new RibbonControlsChangedEventHandler( Ribbon_RibbonControlsChanged); m_oRibbon.RunRibbonCommand += new RunRibbonCommandEventHandler( Ribbon_RunRibbonCommand); CreateNodeXLControl(oGeneralUserSettings); CreateGraphZoomAndScaleControl(); oNodeXLControl.GraphScale = ( new GraphZoomAndScaleUserSettings() ).GraphScale; ApplyGeneralUserSettings(oGeneralUserSettings); ApplyLayoutUserSettings(oLayoutUserSettings); this.ShowGraphLegend = m_oRibbon.ShowGraphLegend; UpdateAutoFillResultsLegend(oPerWorkbookSettings); UpdateDynamicFiltersLegend(); UpdateAxes(oPerWorkbookSettings); AssertValid(); }