private void btnSelectOutLocation_Click(object sender, EventArgs e) { frmOpenFile file = new frmOpenFile { Text = "保存位置" }; file.RemoveAllFilters(); file.AddFilter(new MyGxFilterWorkspaces(), true); if (file.DoModalSaveLocation() == DialogResult.OK) { IArray items = file.Items; if (items.Count != 0) { this.igxObject_0 = items.get_Element(0) as IGxObject; this.iname_0 = this.igxObject_0.InternalObjectName; if (this.igxObject_0 is IGxDatabase) { this.iname_0 = this.igxObject_0.InternalObjectName; } else if (this.igxObject_0 is IGxFolder) { IWorkspaceName name = new WorkspaceNameClass { WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory", PathName = (this.igxObject_0.InternalObjectName as IFileName).Path }; this.iname_0 = name as IName; } this.txtOutLocation.Text = this.igxObject_0.FullName; } } }
private void btnSelectOutLocation_Click(object sender, EventArgs e) { frmOpenFile frmOpenFile = new frmOpenFile(); frmOpenFile.Text = "保存位置"; frmOpenFile.RemoveAllFilters(); frmOpenFile.AddFilter(new MyGxFilterWorkspaces(), true); frmOpenFile.AddFilter(new MyGxFilterRasterCatalogDatasets(), false); if (frmOpenFile.DoModalSaveLocation() == DialogResult.OK) { IArray items = frmOpenFile.Items; if (items.Count != 0) { this.m_pOutGxObject = (items.get_Element(0) as IGxObject); if (this.m_pOutGxObject is IGxDatabase) { this.m_pOutName = this.m_pOutGxObject.InternalObjectName; } else { if (!(this.m_pOutGxObject is IGxDataset)) { return; } if ((this.m_pOutGxObject as IGxDataset).Type != esriDatasetType.esriDTRasterCatalog) { return; } this.m_pOutName = this.m_pOutGxObject.InternalObjectName; } this.txtOutLocation.Text = this.m_pOutGxObject.FullName; } } }
private void btnSelectOut_Click(object sender, EventArgs e) { frmOpenFile file = new frmOpenFile { Text = "保存位置" }; file.RemoveAllFilters(); file.AddFilter(new MyGxFilterWorkspaces(), true); file.AddFilter(new MyGxFilterFeatureDatasets(), false); if (file.DoModalSaveLocation() == DialogResult.OK) { IArray items = file.Items; if (items.Count != 0) { this.igxObject_0 = items.get_Element(0) as IGxObject; this.iname_0 = this.igxObject_0.InternalObjectName; if (this.igxObject_0 is IGxDatabase) { this.iname_0 = this.igxObject_0.InternalObjectName; this.iworkspace_0 = this.iname_0.Open() as IWorkspace; this.btnSR.Enabled = true; } else if (this.igxObject_0 is IGxFolder) { IWorkspaceName name = new WorkspaceNameClass { WorkspaceFactoryProgID = "esriDataSourcesFile.ShapefileWorkspaceFactory", PathName = (this.igxObject_0.InternalObjectName as IFileName).Path }; this.iname_0 = name as IName; this.iworkspace_0 = this.iname_0.Open() as IWorkspace; this.btnSR.Enabled = true; } else if (this.igxObject_0 is IGxDataset) { IDatasetName internalObjectName = this.igxObject_0.InternalObjectName as IDatasetName; if (internalObjectName.Type != esriDatasetType.esriDTFeatureDataset) { return; } this.iname_0 = internalObjectName as IName; this.btnSR.Enabled = false; IGeoDataset dataset = (internalObjectName as IName).Open() as IGeoDataset; this.iworkspace_0 = (dataset as IDataset).Workspace; this.ispatialReference_0 = dataset.SpatialReference; this.txtOutSR.Text = this.ispatialReference_0.Name; } this.txtOutFeat.Text = this.igxObject_0.FullName; } } }
private void btnSelectWorkspace_Click(object sender, EventArgs e) { frmOpenFile frmOpenFile = new frmOpenFile() { Text = "保存位置", AllowMultiSelect = false }; frmOpenFile.AddFilter(new MyGxFilterGeoDatabases(), true); if (frmOpenFile.DoModalSaveLocation() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; this.txtSaveAt.Text = frmOpenFile.SelectedItems[0].ToString(); _saveWorkspace = ((IGxObject)frmOpenFile.SelectedItems[0]).InternalObjectName.Open() as IWorkspace; Cursor.Current = Cursors.Default; } }