/// <summary> /// 直接打开ORACLE数据库中的工作空间 /// </summary> /// <param name="strDataSource">数据源</param> /// <param name="strUser">用户名</param> /// <param name="strPassword">密码</param> /// <returns>返回工作空间</returns> private static IWorkspace OpenOracleWorkspace(string strDataSource, string strUser, string strPassword) { IWorkspaceFactory myIWorkspaceFactory = new OLEDBWorkspaceFactoryClass(); IPropertySet myIPropertySet; myIPropertySet = new PropertySetClass(); myIPropertySet.SetProperty("CONNECTSTRING", "Provide=oraoledb.oracle;Data Source=" + strDataSource + ";User Id=" + strUser + ";Password=" + strPassword); IWorkspace myIWorkspace = null; try { myIWorkspace = myIWorkspaceFactory.Open(myIPropertySet, 0); } catch { } return(myIWorkspace); }
private void method_0() { this.igxObjectArray_0.Empty(); IGxObject obj2 = new GxNewDatabase(); IWorkspaceFactory factory = new OLEDBWorkspaceFactoryClass(); (obj2 as IGxNewDatabase).WorkspaceFactory = factory; obj2.Attach(this, this.igxCatalog_0); obj2 = new GxNewDatabase(); factory = new SdeWorkspaceFactoryClass(); (obj2 as IGxNewDatabase).WorkspaceFactory = factory; obj2.Attach(this, this.igxCatalog_0); if (Directory.Exists(this.string_0)) { IWorkspaceName name; foreach (string str in Directory.GetFiles(this.string_0, "*.sde")) { obj2 = new GxDatabase(); name = new WorkspaceNameClass { WorkspaceFactoryProgID = "esriDataSourcesGDB.SdeWorkspaceFactory", PathName = str }; (obj2 as IGxDatabase).WorkspaceName = name; obj2.Attach(this, this.igxCatalog_0); } foreach (string str in Directory.GetFiles(this.string_0, "*.odc")) { obj2 = new GxDatabase(); name = new WorkspaceNameClass { WorkspaceFactoryProgID = "esriDataSourcesOleDB.OLEDBWorkspaceFactory", PathName = str }; (obj2 as IGxDatabase).WorkspaceName = name; obj2.Attach(this, this.igxCatalog_0); } } }
private void SelectByJoin(string scratchMdbPath, string selectionDatasetName) { bool restoreEditSession = InEditingSession && HluLayerBeingEdited; if (restoreEditSession) CloseEditSession(true); IRelationshipClass relClass = null; IDataset joinDataset; ITable joinTable; IWorkspaceFactory joinWorkspaceFactory = new OLEDBWorkspaceFactoryClass(); try { SetCursor(true); OpenOleDbWorkspace(scratchMdbPath, selectionDatasetName, ref joinWorkspaceFactory, out joinDataset, out joinTable); if ((joinTable.Fields.FieldCount == 1) && (joinTable.Fields.get_Field(0).Name == _hluLayerStructure.incidColumn.ColumnName)) // single column incid: use a join { IDisplayTable hluDisplayTable = (IDisplayTable)_hluLayer; IFeatureClass hluDisplayTableFeatureClass = (IFeatureClass)hluDisplayTable.DisplayTable; ITable hluLayerTable = (ITable)hluDisplayTableFeatureClass; string originPKJoinField = _hluLayerStructure.incidColumn.ColumnName; string originFKJoinField = _hluFeatureClass.Fields.get_Field(_hluFieldMap[_hluLayerStructure.incidColumn.Ordinal]).Name; // create virtual relate IMemoryRelationshipClassFactory memoryRelFactory = new MemoryRelationshipClassFactoryClass(); relClass = memoryRelFactory.Open("SelRelClass", (IObjectClass)joinTable, originPKJoinField, (IObjectClass)hluLayerTable, originFKJoinField, "forward", "backward", esriRelCardinality.esriRelCardinalityOneToMany); // use Relate to perform a join IDisplayRelationshipClass displayRelClass = (IDisplayRelationshipClass)_hluLayer; displayRelClass.DisplayRelationshipClass(relClass, esriJoinType.esriLeftOuterJoin); _joinedTable = true; Regex fldNameRegex = new Regex(@"((""|\[)*" + selectionDatasetName + @"(""|\[)*\.)*(""|\])*" + originPKJoinField + @"(""|\])*", RegexOptions.IgnoreCase); string joinExpr = originPKJoinField; string s = null; for (int i = hluDisplayTable.DisplayTable.Fields.FieldCount - 1; i > 0; i--) { s = hluDisplayTable.DisplayTable.Fields.get_Field(i).Name; if (fldNameRegex.IsMatch(s)) { joinExpr = s; break; } } IQueryFilter queryFilter = new QueryFilterClass(); queryFilter.WhereClause = String.Format("{0} IS NOT NULL", joinExpr); // invalidate only the selection cache. Flag the original selection _hluView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null); // perform selection ISelectionSet selSet = hluDisplayTable.SelectDisplayTable(queryFilter, esriSelectionType.esriSelectionTypeHybrid, esriSelectionOption.esriSelectionOptionNormal, null); _hluFeatureSelection = (IFeatureSelection)_hluLayer; _hluFeatureSelection.SelectionSet = selSet; } else // multi-column join: use cumulative selection sets { SelectByJoinMultiColumn(joinTable); } } catch { } finally { // Remove the virtual relationship. if (relClass != null) { //IRelationshipClassCollectionEdit relClassEdit = (IRelationshipClassCollectionEdit)joinLayer; //relClassEdit.RemoveAllRelationshipClasses(); ((IDisplayRelationshipClass)_hluLayer).DisplayRelationshipClass( null, esriJoinType.esriLeftInnerJoin); } // Destroy workspace factory so the attribute dataset can // be deleted later. joinDataset = null; joinTable = null; joinWorkspaceFactory = null; if (restoreEditSession) OpenEditSession(); SetCursor(false); } }
private void OpenOleDbWorkspace(string tempMdbPathName, string datasetName, ref IWorkspaceFactory workspaceFactory, out IDataset attributeDataset, out ITable exportAttributes) { if (!File.Exists(tempMdbPathName)) throw new IOException("File not found"); IPropertySet propertySet = new PropertySet(); propertySet.SetProperty("CONNECTSTRING", String.Format(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", tempMdbPathName)); workspaceFactory = new OLEDBWorkspaceFactoryClass(); IWorkspace exportWorkspace = workspaceFactory.Open(propertySet, 0); exportAttributes = null; attributeDataset = null; IEnumDataset enumExportDatasets = exportWorkspace.get_Datasets(esriDatasetType.esriDTAny); while ((attributeDataset = enumExportDatasets.Next()) != null) { if (attributeDataset.Name == datasetName) { object attributeDatasetObject = attributeDataset.FullName.Open(); exportAttributes = attributeDataset as ITable; break; } } }
private void Export(string tempMdbPathName, string attributeDatasetName, bool selectedOnly) { IRelationshipClass relClass = null; IFeatureClass outFeatureClass = null; IFeatureClass joinFeatureClass = null; IFeatureLayer joinLayer = null; IDataset attributeDataset; ITable exportAttributes; IWorkspaceFactory joinWorkspaceFactory = new OLEDBWorkspaceFactoryClass(); object outWS = null; try { SetCursor(true); OpenOleDbWorkspace(tempMdbPathName, attributeDatasetName, ref joinWorkspaceFactory, out attributeDataset, out exportAttributes); IDisplayTable hluDisplayTable = (IDisplayTable)_hluLayer; IFeatureClass hluDisplayTableFeatureClass = (IFeatureClass)hluDisplayTable.DisplayTable; // Set the selected and total feature counts. int selectedFeatureCount = _hluFeatureSelection.SelectionSet.Count; int totalFeatureCount = _hluLayer.FeatureClass.FeatureCount(null); int exportFeatureCount = 0; // Prompt the user for where to save the export layer. IExportOperation exportOp = new ExportOperation(); bool saveProjection; esriExportTableOptions exportOptions; IDatasetName exportDatasetName = exportOp.GetOptions(hluDisplayTableFeatureClass, _hluLayer.Name, _hluFeatureSelection != null && _hluFeatureSelection.SelectionSet.Count > 0, true, _application.hWnd, out saveProjection, out exportOptions); // If no export dataset name was chosen by the user then cancel the export. if (exportDatasetName == null) { _pipeData.Add("cancelled"); return; } // Open the export dataset workspace. outWS = ((IName)exportDatasetName.WorkspaceName).Open(); // Determine if the export layer is a shapefile. bool isShp = IsShp(outWS as IWorkspace); //--------------------------------------------------------------------- // FIX: 050 Warn ArcGIS users if field names may be truncated or // renamed exporting to shapefiles. // // If the export layer is a shapefile check if any of // the attribute field names will be truncated. if (isShp) { bool fieldNamesTruncated = false; for (int i = 0; i < exportAttributes.Fields.FieldCount; i++) { IField attributeField = exportAttributes.Fields.get_Field(i); if (attributeField.Name.Length > 10) { fieldNamesTruncated = true; break; } } // Warn the user that some field names may get truncated. if (fieldNamesTruncated) { MessageBoxResult userResponse = MessageBoxResult.No; userResponse = MessageBox.Show("Some field names may get truncated or renamed exporting to a shapefile.\n\nDo you wish to proceed?", "HLU: Export", MessageBoxButton.YesNo, MessageBoxImage.Question); if (userResponse != MessageBoxResult.Yes) { _pipeData.Add("cancelled"); return; } } } //--------------------------------------------------------------------- // Get the geometry definition for the feature layer. IGeometryDef geomDef = _hluFeatureClass.Fields.get_Field(_hluFeatureClass.FindField( _hluFeatureClass.ShapeFieldName)).GeometryDef; ITable joinLayerTable; IDisplayTable joinDisplayTable; //--------------------------------------------------------------------- // CHANGED: CR13 (Export features performance) // // If only a sub-set of features are being exported then // export the sub-set to a temporary feature class before // joining the temporary layer to the attribute dataset. if (selectedOnly) { // Set the export options for which records to export. exportOptions = esriExportTableOptions.esriExportSelectedRecords; // Set the input DataSet name IDataset inDataset; inDataset = (IDataset)hluDisplayTable.DisplayTable; IDatasetName inDatasetName; inDatasetName = (IDatasetName)inDataset.FullName; // set the output temporary DataSet name IFeatureClassName outFCName = new FeatureClassNameClass(); IDatasetName outDatasetName = (IDatasetName)outFCName; outDatasetName.Name = String.Format("{0}_temp", exportDatasetName.Name); outDatasetName.WorkspaceName = exportDatasetName.WorkspaceName; // Get the selected features for export ISelectionSet selectionSet = _hluFeatureSelection.SelectionSet; // If there is no selection cancel the export. if (_hluFeatureSelection.SelectionSet.Count == 0) { _pipeData.Add("noselection"); return; } // Export the selected features to the temporary dataset. exportOp.ExportFeatureClass(inDatasetName, null, selectionSet, geomDef, (IFeatureClassName)outDatasetName, _application.hWnd); // Cast the workspace to IFeatureWorkspace and open the feature class. IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)outWS; joinFeatureClass = featureWorkspace.OpenFeatureClass(outDatasetName.Name); // Add an attribute index to the incid field. AddFieldIndex(joinFeatureClass, String.Format("IX_{0}", _hluLayerStructure.incidColumn.ColumnName), _hluLayerStructure.incidColumn.ColumnName); // Set the join layer to the temporary feature class. joinLayer = new FeatureLayerClass(); joinLayer.FeatureClass = joinFeatureClass; joinLayer.Name = joinFeatureClass.AliasName; // Set the join layer table to the temporary feature class. joinDisplayTable = (IDisplayTable)joinLayer; //IFeatureClass joinDisplayTableFC = (IFeatureClass)joinDisplayTable.DisplayTable; IFeatureClass joinDisplayTableFC = joinFeatureClass; joinLayerTable = (ITable)joinDisplayTableFC; // Set the count for the number of features to be exported. exportFeatureCount = selectedFeatureCount; } // Otherwise, join the whole feature layer to the // attribute dataset. else { // Clear any current selection. _hluFeatureSelection.SelectionSet = null; // Set the export options for which records to export. exportOptions = esriExportTableOptions.esriExportAllRecords; // Set the join feature class to the current HLU feature class. joinFeatureClass = _hluFeatureClass; // Set the join layer to the current HLU feature layer. joinLayer = _hluLayer; joinLayerTable = (ITable)hluDisplayTableFeatureClass; joinDisplayTable = hluDisplayTable; // Set the count for the number of features to be exported. exportFeatureCount = totalFeatureCount; } //--------------------------------------------------------------------- // Get the field names to be used when joining the attribute data and the feature layer string originPKJoinField = _hluLayerStructure.incidColumn.ColumnName; string originFKJoinField = _hluFeatureClass.Fields.get_Field(_hluFieldMap[_hluLayerStructure.incidColumn.Ordinal]).Name; // Get a list of all the fields to be used in the export layer (plus separate lists of all // those fields that will come from the attribute table and those that will come from the // feature layer). List<IField> attributeFields; List<IField> featClassFields; List<IField> exportFields = ExportFieldLists(isShp, originPKJoinField, originFKJoinField, joinFeatureClass, exportAttributes, out attributeFields, out featClassFields); // Add x/y, length, or area and length fields to the list of fields in the export layer // if the export layer is a shapefile. ExportAddGeometryPropertyFields(isShp, exportFields); // Create a virtual relationship between the feature class // and the attribute dataset. IMemoryRelationshipClassFactory memoryRelFactory = new MemoryRelationshipClassFactoryClass(); relClass = memoryRelFactory.Open("ExportRelClass", (IObjectClass)exportAttributes, originPKJoinField, (IObjectClass)joinLayerTable, originFKJoinField, "forward", "backward", esriRelCardinality.esriRelCardinalityOneToMany); // Use the relationship to perform a join. IDisplayRelationshipClass displayRelClass = (IDisplayRelationshipClass)joinLayer; displayRelClass.DisplayRelationshipClass(relClass, esriJoinType.esriLeftInnerJoin); // Create query filter for the export cursor so that // only the required fields are retrieved. bool featClassFieldsQualified; bool attributeFieldsQualified; IQueryFilter exportQueryFilter = ExportQueryFilter(originPKJoinField, joinLayer, joinFeatureClass, joinDisplayTable, attributeDataset, featClassFields, attributeFields, out featClassFieldsQualified, out attributeFieldsQualified); // Create a collection of fields for the output feature class. // Adds OID and SHAPE at beginning. IFields outFields = CreateFieldsCollection(true, geomDef.HasZ, geomDef.HasM, outWS, joinFeatureClass.ShapeType, exportFields.Select(f => f.Length).ToArray(), exportFields.Select(f => f.Name).ToArray(), exportFields.Select(f => f.Name).ToArray(), exportFields.Select(f => f.Type).ToArray(), exportFields.Select(f => f.Type != esriFieldType.esriFieldTypeOID).ToArray(), geomDef.SpatialReference); // Create the output feature class. outFeatureClass = CreateFeatureClass(exportDatasetName.Name, null, outWS, outFields, esriFeatureType.esriFTSimple, joinFeatureClass.ShapeType, null, null); // Map the fields between the display and table and the output feature // class as the display table always includes all fields. // The first two fields are always OID and SHAPE. int[] exportFieldMap = new int[] { 0, 1 }.Concat(featClassFields .Select(f => joinDisplayTable.DisplayTable.Fields.FindField(featClassFieldsQualified ? joinLayer.Name + "." + f.Name : f.Name))).Concat(attributeFields .Select(f => joinDisplayTable.DisplayTable.Fields.FindField(attributeFieldsQualified ? attributeDataset.Name + "." + f.Name : f.Name))).ToArray(); //--------------------------------------------------------------------- // FIX: 038 Display the export progress bar correctly when exporting // from ArcGIS. // Pass the number of features to be exported, not the number of incids, // so that the export progress is displayed corectly // // Insert the features and attributes into the new feature class. ExportInsertFeatures(joinDisplayTable, exportQueryFilter, exportFeatureCount, exportFieldMap, isShp, outWS, outFeatureClass); //--------------------------------------------------------------------- //--------------------------------------------------------------------- // CHANGED: CR16 (Adding exported features) // Ask the user if they want to add the new export layer // to the active map. MessageBoxResult addResponse = MessageBoxResult.No; addResponse = MessageBox.Show("The export operation succeeded.\n\nAdd the exported layer to the current map?", "HLU: Export", MessageBoxButton.YesNo, MessageBoxImage.Question); if (addResponse == MessageBoxResult.Yes) { // Add the exported feature layer to the active map. IFeatureLayer hluExportLayer; hluExportLayer = new FeatureLayer(); hluExportLayer.FeatureClass = outFeatureClass; hluExportLayer.Name = outFeatureClass.AliasName; _focusMap.AddLayer(hluExportLayer); } //--------------------------------------------------------------------- } catch (Exception ex) { _pipeData.Add(ex.Message); } finally { // Remove the virtual relationship. if (relClass != null) { //IRelationshipClassCollectionEdit relClassEdit = (IRelationshipClassCollectionEdit)joinLayer; //relClassEdit.RemoveAllRelationshipClasses(); ((IDisplayRelationshipClass)joinLayer).DisplayRelationshipClass( null, esriJoinType.esriLeftInnerJoin); } // Destroy workspace factory so the attribute dataset can // be deleted later. attributeDataset = null; exportAttributes = null; joinWorkspaceFactory = null; // Delete the temporary feature class. try { if (joinFeatureClass != _hluFeatureClass) { IDataset tempDataset = (IDataset)joinFeatureClass; if (tempDataset != null) tempDataset.Delete(); } } catch { } SetCursor(false); } }
private void listView1_DoubleClick(object sender, EventArgs e) { if (this.listView1.SelectedItems.Count != 0) { MyDoubleClickResult myDCRShowChildren; IGxObject tag = this.listView1.SelectedItems[0].Tag as IGxObject; if ((this.igxObjectFilter_0 != null) && (tag is IGxDatabase)) { myDCRShowChildren = MyDoubleClickResult.myDCRShowChildren; this.igxObjectFilter_0.CanChooseObject(tag, ref myDCRShowChildren); if (myDCRShowChildren == MyDoubleClickResult.myDCRChooseAndDismiss) { this.method_4(); return; } } if (!(tag is IGxObjectContainer)) { if (tag is IGxNewDatabase) { IWorkspaceName name; IGxObject obj3; ListViewItem item; if (tag.FullName == "添加OLE DB连接") { try { string path = Environment.SystemDirectory.Substring(0, 2) + @"\Documents and Settings\Administrator\Application Data\ESRI\ArcCatalog\"; string str2 = path + "OLE DB Connection.odc"; if (Directory.Exists(path)) { str2 = this.method_6(str2); IWorkspaceFactory factory = new OLEDBWorkspaceFactoryClass(); name = factory.Create(path, System.IO.Path.GetFileName(str2), null, 0); obj3 = new GxDatabase(); (obj3 as IGxDatabase).WorkspaceName = name; obj3.Attach(tag.Parent, this.igxCatalog_0); item = new ListViewItem(new string[] { obj3.Name, obj3.Category }, this.method_2(obj3)) { Tag = obj3 }; this.listView1.Items.Add(item); } } catch (Exception exception) { exception.ToString(); } } else if (tag.FullName == "添加空间数据库连接") { frmCreateGDBConnection connection = new frmCreateGDBConnection { TopMost = true }; if (connection.ShowDialog() == DialogResult.OK) { obj3 = new GxDatabase(); name = new WorkspaceNameClass { WorkspaceFactoryProgID = "esriDataSourcesGDB.SdeWorkspaceFactory", PathName = connection.ConnectionPath }; (obj3 as IGxDatabase).WorkspaceName = name; obj3.Attach(tag.Parent, this.igxCatalog_0); item = new ListViewItem(new string[] { obj3.Name, obj3.Category }, this.method_2(obj3)) { Tag = obj3 }; this.listView1.Items.Add(item); } } } else { this.method_4(); } } else { ImageComboBoxItemEx ex; if (tag is IGxDataset) { esriDatasetType type = (tag as IGxDataset).Type; myDCRShowChildren = MyDoubleClickResult.myDCRShowChildren; this.igxObjectFilter_0.CanChooseObject(tag, ref myDCRShowChildren); if ((((type != esriDatasetType.esriDTFeatureDataset) && (type != esriDatasetType.esriDTContainer)) && ((type != esriDatasetType.esriDTRasterCatalog) && (type != esriDatasetType.esriDTCadDrawing))) && (type != esriDatasetType.esriDTRasterDataset)) { this.method_4(); return; } } this.method_10(tag); this.bool_0 = false; if (tag.Parent is IGxCatalog) { for (int i = 0; i < this.imageComboBoxEdit1.Properties.Items.Count; i++) { ex = this.imageComboBoxEdit1.Properties.Items[i] as ImageComboBoxItemEx; if (ex.Tag == tag) { this.imageComboBoxEdit1.SelectedIndex = i; break; } } } else { ex = this.imageComboBoxEdit1.Properties.Items[this.imageComboBoxEdit1.SelectedIndex] as ImageComboBoxItemEx; int degree = ex.Degree; ex = new ImageComboBoxItemEx(tag.Name, tag.FullName, this.method_2(tag), degree + 1) { Tag = tag }; int selectedIndex = this.imageComboBoxEdit1.SelectedIndex; this.imageComboBoxEdit1.Properties.Items.Insert(selectedIndex + 1, ex); this.imageComboBoxEdit1.SelectedIndex = selectedIndex + 1; } this.bool_0 = true; } } }
private void KTreeView_DoubleClick(object sender, EventArgs e) { if (base.SelectedNode != null) { IGxObject tag = base.SelectedNode.Tag as IGxObject; if (tag != null) { IGxObject newObject; TreeNode node; Exception exception; if (tag is IGxNewDatabase) { IWorkspaceName name; if (tag.FullName == "添加OLE DB连接") { try { string path = Environment.SystemDirectory.Substring(0, 2) + @"\Documents and Settings\Administrator\Application Data\ESRI\ArcCatalog\"; string str2 = path + "OLE DB Connection.odc"; if (Directory.Exists(path)) { str2 = this.method_17(str2); IWorkspaceFactory factory = new OLEDBWorkspaceFactoryClass(); name = factory.Create(path, System.IO.Path.GetFileName(str2), null, 0); newObject = new GxDatabase(); (newObject as IGxDatabase).WorkspaceName = name; newObject.Attach(tag.Parent, this.igxCatalog_0); node = new TreeNode(newObject.Name, this.method_3(newObject), this.method_4(newObject)) { Tag = newObject }; base.SelectedNode.Parent.Nodes.Add(node); } } catch (Exception exception1) { exception = exception1; exception.ToString(); } } else if (tag.FullName == "添加空间数据库连接") { frmCreateGDBConnection connection = new frmCreateGDBConnection(); if (connection.ShowDialog() == DialogResult.OK) { newObject = new GxDatabase(); name = new WorkspaceNameClass { WorkspaceFactoryProgID = "esriDataSourcesGDB.SdeWorkspaceFactory", PathName = connection.ConnectionPath }; (newObject as IGxDatabase).WorkspaceName = name; newObject.Attach(tag.Parent, this.igxCatalog_0); node = new TreeNode(newObject.Name, this.method_3(newObject), this.method_4(newObject)) { Tag = newObject }; base.SelectedNode.Parent.Nodes.Add(node); } } } else if (tag.FullName == "添加Database Server") { frmAddDatabaseServer server = new frmAddDatabaseServer(); if (server.ShowDialog() != DialogResult.OK) { } } else if (tag is IGxDatabase) { if ((tag as IGxDatabase).IsRemoteDatabase && !(tag as IGxDatabase).IsConnected) { this.ConnectDatabase(); } } else if (tag is IGxAGSConnection) { if (!(tag as IGxAGSConnection).IsConnected) { this.ConnectArcGISServer(); } } else if (tag is IGxGDSConnection) { System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; IGxObject obj4 = base.SelectedNode.Tag as IGxObject; (obj4 as IGxGDSConnection).Connect(); if ((obj4 as IGxGDSConnection).IsConnected) { this.method_7(base.SelectedNode); base.SelectedNode.ImageIndex = this.method_3(obj4); base.SelectedNode.SelectedImageIndex = this.method_4(obj4); GxCatalogCommon.GetCatalog(tag).ObjectRefreshed(obj4); } System.Windows.Forms.Cursor.Current = Cursors.Default; } else if (tag.Name == "添加ArcGIS Server") { frmNewArcGISServer server2 = new frmNewArcGISServer(); if (server2.ShowDialog() == DialogResult.OK) { newObject = server2.NewObject; if (newObject != null) { newObject.Attach(tag.Parent, this.igxCatalog_0); node = new TreeNode(newObject.Name, this.method_3(newObject), this.method_4(newObject)) { Tag = newObject }; base.SelectedNode.Parent.Nodes.Add(node); } } } else if (tag.Name == "添加Server Object") { try { frmNewServerObject obj5 = new frmNewServerObject { AGSServerConnectionName = (tag.Parent as IGxAGSConnection).AGSServerConnectionName }; if (obj5.ShowDialog() == DialogResult.OK) { tag.Parent.Refresh(); } } catch (Exception exception2) { exception = exception2; } } } } }