Пример #1
0
        private void btnServer_Click(object sender, EventArgs e)
        {
            frmXZDBPropertySet frm = new frmXZDBPropertySet();

            frm.GetPropertySetStr = textSource.Text;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                textSource.Text  = frm.GetPropertySetStr;
                pTargetworkspace = frm.m_pworkspace;
            }
        }
Пример #2
0
        //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);
                    }
                }
            }
        }
Пример #3
0
        //选择源数据
        private void btnOrg_Click(object sender, EventArgs e)
        {
            switch (comboBoxOrgType.Tag.ToString())   //cyf 20110626 modify:
            {
            case "SDE":
                //frmDBPropertySet frmSet = new frmDBPropertySet("设置SDE连接", "SDE");
                frmXZDBPropertySet frmSet = new frmXZDBPropertySet();
                frmSet.ShowDialog();
                if (frmSet.Res == true)
                {
                    if (!listViewEx.Items.ContainsKey(frmSet.GetPropertySetStr))
                    {
                        ListViewItem aItem = listViewEx.Items.Add(frmSet.GetPropertySetStr, frmSet.GetPropertySetStr, "");
                        aItem.Tag         = "SDE";
                        aItem.Checked     = true;
                        aItem.ToolTipText = frmSet.GetPropertySetStr;
                    }
                    else
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "列表中已添加该项!");
                    }
                }
                break;

            case "GDB":
                FolderBrowserDialog pFolderBrowser = new FolderBrowserDialog();
                if (pFolderBrowser.ShowDialog() == DialogResult.OK)
                {
                    if (pFolderBrowser.SelectedPath.EndsWith(".gdb"))
                    {
                        if (!listViewEx.Items.ContainsKey(pFolderBrowser.SelectedPath))
                        {
                            ListViewItem aItem = listViewEx.Items.Add(pFolderBrowser.SelectedPath, pFolderBrowser.SelectedPath, "");
                            aItem.Tag         = "GDB";
                            aItem.Checked     = true;
                            aItem.ToolTipText = pFolderBrowser.SelectedPath;
                        }
                        else
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "列表中已添加该项!");
                        }
                    }
                    else
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "请选择GDB格式文件!");
                    }
                }
                break;

            case "SHP":
                FolderBrowserDialog pFolderBrowser1 = new FolderBrowserDialog();
                if (pFolderBrowser1.ShowDialog() == DialogResult.OK)
                {
                    if (!listViewEx.Items.ContainsKey(pFolderBrowser1.SelectedPath))
                    {
                        ListViewItem aItem = listViewEx.Items.Add(pFolderBrowser1.SelectedPath, pFolderBrowser1.SelectedPath, "");
                        aItem.Tag         = "SHP";
                        aItem.Checked     = true;
                        aItem.ToolTipText = pFolderBrowser1.SelectedPath;
                    }
                    else
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "列表中已添加该项!");
                    }
                }
                break;

            case "PDB":
                OpenFileDialog OpenFile = new OpenFileDialog();
                OpenFile.CheckFileExists = true;
                OpenFile.CheckPathExists = true;
                OpenFile.Title           = "选择ESRI个人数据库";
                OpenFile.Filter          = "ESRI个人数据库(*.mdb)|*.mdb";
                OpenFile.Multiselect     = true;
                if (OpenFile.ShowDialog() == DialogResult.OK)
                {
                    for (int i = 0; i < OpenFile.FileNames.Length; i++)
                    {
                        if (!listViewEx.Items.ContainsKey(OpenFile.FileNames[i]))
                        {
                            ListViewItem aItem = listViewEx.Items.Add(OpenFile.FileNames[i], OpenFile.FileNames[i], "");
                            aItem.Tag         = "PDB";
                            aItem.Checked     = true;
                            aItem.ToolTipText = OpenFile.FileNames[i];
                        }
                        else
                        {
                            SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "列表中已添加该项!");
                        }
                    }
                }
                break;

            default:
                break;
            }
        }