//************************************************************************* // Constructor: GroupUserSettingsDialog() // /// <summary> /// Initializes a new instance of the <see /// cref="GroupUserSettingsDialog" /> class. /// </summary> /// /// <param name="groupUserSettings"> /// The object being edited. /// </param> //************************************************************************* public GroupUserSettingsDialog ( GroupUserSettings groupUserSettings ) { Debug.Assert(groupUserSettings != null); m_oGroupUserSettings = groupUserSettings; InitializeComponent(); // Instantiate an object that saves and retrieves the user settings for // this dialog. Note that the object automatically saves the settings // when the form closes. m_oGroupUserSettingsDialogUserSettings = new GroupUserSettingsDialogUserSettings(this); DoDataExchange(false); AssertValid(); }
ReadWorkbook ( Boolean bLayOutGraph ) { AssertValid(); if (oNodeXLControl.IsLayingOutGraph) { return; } RemoveSplashScreen(); if ( !this.NonEmptyWorkbookRead && this.LayoutIsNull && !ShowLayoutTypeIsNullNotification() ) { return; } // This is in case another open workbook has modified the user // settings. GeneralUserSettings oGeneralUserSettings = new GeneralUserSettings(); GroupUserSettings oGroupUserSettings = new GroupUserSettings(); ApplyGeneralUserSettings(oGeneralUserSettings); ApplyLayoutUserSettings( new LayoutUserSettings() ); ReadWorkbookContext oReadWorkbookContext = new ReadWorkbookContext(); oReadWorkbookContext.IgnoreVertexLocations = false; oReadWorkbookContext.GraphRectangle = this.GraphRectangle; oReadWorkbookContext.FillIDColumns = true; oReadWorkbookContext.ReadGroups = oGroupUserSettings.ReadGroups; oReadWorkbookContext.ReadEdgeWeights = true; oReadWorkbookContext.ReadVertexColorFromGroups = oGroupUserSettings.ReadVertexColorFromGroups; oReadWorkbookContext.ReadVertexShapeFromGroups = oGroupUserSettings.ReadVertexShapeFromGroups; oReadWorkbookContext.ReadVertexLabels = m_oRibbon.ReadVertexLabels; oReadWorkbookContext.ReadEdgeLabels = m_oRibbon.ReadEdgeLabels; oReadWorkbookContext.ReadGroupLabels = m_oRibbon.ReadGroupLabels; oReadWorkbookContext.ReadVertexImages = true; oReadWorkbookContext.DefaultVertexImageSize = oGeneralUserSettings.VertexImageSize; oReadWorkbookContext.DefaultVertexShape = oGeneralUserSettings.VertexShape; // Populate the vertex worksheet. This isn't strictly necessary, but // it does enable the vertex worksheet to be updated when the user // edits vertex attributes in the NodeXL graph. (If the vertex // worksheet is missing, vertex attributes can still be edited in the // graph; the edits just won't get saved in the workbook.) oReadWorkbookContext.PopulateVertexWorksheet = true; WorkbookReader oWorkbookReader = new WorkbookReader(); m_oEdgeRowIDDictionary = null; m_oVertexRowIDDictionary = null; EnableGraphControls(false); try { // Read the workbook into a Graph object. IGraph oGraph = oWorkbookReader.ReadWorkbook( m_oWorkbook, oReadWorkbookContext); // Save the edge and vertex dictionaries that were created by // WorkbookReader. m_oEdgeRowIDDictionary = oReadWorkbookContext.EdgeRowIDDictionary; m_oVertexRowIDDictionary = oReadWorkbookContext.VertexRowIDDictionary; // Load the NodeXLControl with the resulting graph. oNodeXLControl.Graph = oGraph; // Collapse any groups that are supposed to be collapsed. CollapseOrExpandGroups(GetGroupNamesToCollapse(oGraph), true, false); // Enable tooltips in case tooltips were specified in the workbook. oNodeXLControl.ShowVertexToolTips = true; // If the dynamic filter dialog is open, read the dynamic filter // columns it filled in. if (m_oDynamicFilterDialog != null) { ReadDynamicFilterColumns(false); DynamicFilterHandler.ReadFilteredAlpha(m_oDynamicFilterDialog, oNodeXLControl, false); } oNodeXLControl.DrawGraph(bLayOutGraph); PerWorkbookSettings oPerWorkbookSettings = this.PerWorkbookSettings; UpdateAutoFillResultsLegend(oPerWorkbookSettings); UpdateDynamicFiltersLegend(); UpdateAxes(oPerWorkbookSettings); UpdateGraphHistory(oPerWorkbookSettings); } catch (Exception oException) { // If exceptions aren't caught here, Excel consumes them without // indicating that anything is wrong. This can result in the graph // controls remaining disabled, among other problems. ErrorUtil.OnException(oException); } finally { EnableGraphControls(true); } // Change the button text to indicate that if any of the buttons is // clicked again, the graph will be read again. tsbReadWorkbook.Text = msiContextReadWorkbook.Text = m_oRibbon.ReadWorkbookButtonText = "Refresh Graph"; }