//cyf 2011065 modify public override void OnClick() { Exception err = null; /////获取工程项目名称 DevComponents.AdvTree.Node vSelectedNode = null; vSelectedNode = m_Hook.ProjectTree.SelectedNode; DevComponents.AdvTree.Node ProjectNode = null; ProjectNode = vSelectedNode; while (ProjectNode.Parent != null) { ProjectNode = ProjectNode.Parent; } //cyf 20110625 add: DevComponents.AdvTree.Node DBNode = null; //数据库树节点 //获取数据库节点 DBNode = vSelectedNode; while (DBNode.Parent != null && DBNode.DataKeyString != "DB") { DBNode = DBNode.Parent; } if (DBNode.DataKeyString != "DB") { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取数据库节点失败!"); return; } DevComponents.AdvTree.Node DtSetNode = vSelectedNode; //数据集树节点 if (DBNode.Text != "现势库") { return; } //XmlElement elementTemp = (DBNode.Tag as XmlElement).SelectSingleNode(".//连接信息") as XmlElement; // IWorkspace TempWorkSpace = ModDBOperator.GetDBInfoByXMLNode(elementTemp, "") as IWorkspace; //ygc 2013-01-19修改临时库创建的位置 frmXZDBPropertySet frm = new frmXZDBPropertySet(); //frm.GetPropertySetStr = textSource.Text; IWorkspace TempWorkSpace = null; if (frm.ShowDialog() == DialogResult.OK) { //textSource.Text = frm.GetPropertySetStr; TempWorkSpace = frm.m_pworkspace; } if (TempWorkSpace == null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接数据库失败!"); return; } SysCommon.Gis.SysGisDataSet sysGisDataset = new SysCommon.Gis.SysGisDataSet(TempWorkSpace); //cyf 20110625 modify IFeatureDataset featureDataset = null; //数据集 if (vSelectedNode.DataKeyString == "FD") { featureDataset = sysGisDataset.GetFeatureDataset(vSelectedNode.Text, out err); if (err != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取数据集失败,请检查该数据集是否存在!"); return; } } Exception pError = null; if (featureDataset != null) { bool bRes = InitialTmpDBstructure(featureDataset); if (bRes) { MessageBox.Show("初始化临时库结构成功!"); //根据工程树图xml刷新工程树图界面 if (File.Exists(ModData.v_projectDetalXML)) { XmlDocument xml = new XmlDocument(); xml.Load(ModData.v_projectDetalXML); ModData.v_AppGIS.DBXmlDocument = xml; ModData.v_AppGIS.ProjectTree.Nodes.Clear(); ModDBOperator.RefreshProjectTree(ModData.v_AppGIS.DBXmlDocument, ModData.v_AppGIS.ProjectTree, out pError); } } } }