public LayoutControl() { InitializeComponent(); GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings(); oGeneralUserSettings.NotUseWorkbookSettings(); LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings(); oLayoutUserSettings.NotUseWorkbookSettings(); LayoutType eInitialLayout = oLayoutUserSettings.Layout; // LayoutType eInitialLayout = LayoutType.FruchtermanReingold; // Instantiate an object that populates the tssbLayout // ToolStripSplitButton and handles its LayoutChanged event. m_oLayoutManagerForToolStripSplitButton = new LayoutManagerForToolStripSplitButton(); m_oLayoutManagerForToolStripSplitButton.AddItems(this.tssbLayout); m_oLayoutManagerForToolStripSplitButton.Layout = eInitialLayout; m_oLayoutManagerForToolStripSplitButton.LayoutChanged += new EventHandler( this.LayoutManagerForToolStripSplitButton_LayoutChanged); CreateNodeXLControl(); CreateGraphZoomAndScaleControl(); // ApplyGeneralUserSettings(oGeneralUserSettings); ApplyLayoutUserSettings(oLayoutUserSettings); AssertValid(); }
//************************************************************************* // 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(); InitializeSplashScreen(); m_oThisWorkbook = thisWorkbook; 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; m_oReadabilityMetricsDialog = null; GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings(); LayoutUserSettings oLayoutUserSettings = new LayoutUserSettings(); LayoutType eInitialLayout = oLayoutUserSettings.Layout; // Instantiate an object that populates the tssbLayout // ToolStripSplitButton and handles its LayoutChanged event. m_oLayoutManagerForToolStripSplitButton = new LayoutManagerForToolStripSplitButton(); m_oLayoutManagerForToolStripSplitButton.AddItems(this.tssbLayout); 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.LayoutManagerForToolStripSplitButton_LayoutChanged); m_oLayoutManagerForContextMenu.LayoutChanged += new EventHandler(this.LayoutManagerForContextMenu_LayoutChanged); // The context menu for groups should be enabled only if the template // supports groups. MenuUtil.EnableToolStripMenuItems( m_iTemplateVersion > GroupManager.MinimumTemplateVersionForGroups, msiContextGroups); thisWorkbook.VisualAttributeSetInWorkbook += new EventHandler(ThisWorkbook_VisualAttributeSetInWorkbook); thisWorkbook.WorksheetContextMenuManager.RequestVertexCommandEnable += new RequestVertexCommandEnableEventHandler( WorksheetContextMenuManager_RequestVertexCommandEnable); thisWorkbook.WorksheetContextMenuManager.RequestEdgeCommandEnable += new RequestEdgeCommandEnableEventHandler( WorksheetContextMenuManager_RequestEdgeCommandEnable); m_oRibbon.Layout = eInitialLayout; CreateNodeXLControl(); CreateGraphZoomAndScaleControl(); ApplyGeneralUserSettings(oGeneralUserSettings); ApplyLayoutUserSettings(oLayoutUserSettings); // Don't show the legend now. If it is supposed to be shown, the // Ribbon, which is responsible for maintaining the visibility of the // legend, will send a NoParamCommand.ShowGraphLegend command to the // TaskPane later. this.ShowGraphLegend = false; UpdateAutoFillResultsLegend(oPerWorkbookSettings); UpdateDynamicFiltersLegend(); UpdateAxes(oPerWorkbookSettings); CommandDispatcher.CommandSent += new RunCommandEventHandler(this.CommandDispatcher_CommandSent); AssertValid(); }