Ejemplo n.º 1
0
        /// <summary>
        /// 测试SDE链接
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        private bool SDEConnectTest()
        {
            ////把界面中的信息作为参数放在数组pStrProp中
            pStrProp[0] = this.txtSet1.Text;
            pStrProp[1] = this.txtSet2.Text;
            pStrProp[2] = this.txtSet3.Text;
            pStrProp[3] = this.txtSet4.Text;
            pStrProp[4] = this.txtSet5.Text;
            pStrProp[5] = this.comboBoxEx1.Text;
            pStrProp[6] = this.comboBoxEx2.Text;

            //主要为了测试连接用,测试连接函数里面用的是IproperSet
            m_SDEPropertSet = ClsSDE.GetPropSetFromArr(pStrProp);

            ////判断是否已经填写完毕
            if (ClsSDE.CheckTxtComplete(pStrProp) == true)
            {
                ////测试连接
                m_pSDEWorkspace = ClsSDE.TestSDELinkState(m_SDEPropertSet);
                if ((m_pSDEWorkspace != null))
                {
                    ClsSDE.SavePropSetting(pStrProp);
                    AddVersionsToComb(m_pSDEWorkspace);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 连接按钮
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnAddSDE_Click(object sender, EventArgs e)
 {
     //修改服务器SDE链接方式,无需单独测试链接,点击连接时自动测试
     if (SDEConnectTest() == true)
     {
         //pStrProp[5] = cboVersion.Text;
         m_SDEPropertSet = ClsSDE.GetPropSetFromArr(pStrProp);
         ClsSDE.CheckTxtComplete(pStrProp);
         m_pSDEWorkspace = ClsSDE.TestSDELinkState(m_SDEPropertSet);
         if ((m_pSDEWorkspace != null))
         {
             Properties             = pStrProp;
             this.DialogResult      = System.Windows.Forms.DialogResult.OK;
             ClsDBInfo.SdeWorkspace = m_pSDEWorkspace;
         }
     }
 }