public override void OnClick()
        {
            if (_AppHk == null)
            {
                return;
            }
            if (_AppHk.MapControl == null)
            {
                return;
            }
            IMap pMap = _AppHk.MapControl.Map;

            if (frmSQL != null)
            {
                frmSQL.Close();
            }
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("河流查询");//xisheng 日志记录;
            }
            string        strLayerName   = "";
            string        strFieldName   = ""; //名称字段
            string        strFieldCode   = ""; //编码字段
            IFeatureClass pRiverFeaClass = null;

            try
            {//查找河流地物类
                ModQuery.GetQueryConfig("河流查询", out pRiverFeaClass, out strLayerName, out strFieldName, out strFieldCode);
                if (pRiverFeaClass == null)
                {
                    MessageBox.Show("找不到河流数据,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                //检查河流名称字段
                if (pRiverFeaClass.FindField(strFieldName) < 0)
                {
                    MessageBox.Show("找不到河流名称属性,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    pRiverFeaClass = null;
                    return;
                }
                //检查河流编码字段
                if (pRiverFeaClass.FindField(strFieldCode) < 0)
                {
                    MessageBox.Show("找不到河流编码属性,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    pRiverFeaClass = null;
                    return;
                }
                frmQueryRoad fmQD = new frmQueryRoad((_AppHk as Plugin.Application.IAppFormRef).MainForm, _AppHk.MapControl, pRiverFeaClass, strLayerName, strFieldName, strFieldCode, "河 流 名:", "河流编码:", "河流查询");
                fmQD.WriteLog = this.WriteLog;
                fmQD.Show((_AppHk as Plugin.Application.IAppFormRef).MainForm);
            }
            catch (Exception ex)
            {
                ErrorHandle.ShowFrmErrorHandle("提示", ex.Message);
            }
        }
Exemple #2
0
        public override void OnClick()
        {
            if (_AppHk == null)
            {
                return;
            }
            if (_AppHk.MapControl == null)
            {
                return;
            }
            IMap pMap = _AppHk.MapControl.Map;

            string        strFieldName  = ""; //名称字段
            string        strFieldCode  = ""; //编码字段
            string        strRoadName   = "铁路查询";
            string        strLayerName  = "";
            IFeatureClass pRoadFeaClass = null;

            try
            {//获取道路地物类
                ModQuery.GetQueryConfig(strRoadName, out pRoadFeaClass, out strLayerName, out strFieldName, out strFieldCode);
                if (pRoadFeaClass == null)
                {
                    MessageBox.Show("找不到铁路数据,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                //检查河流名称字段
                if (pRoadFeaClass.FindField(strFieldName) < 0)
                {
                    MessageBox.Show("找不到铁路名称属性,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    pRoadFeaClass = null;
                    return;
                }
                //检查河流编码字段
                if (pRoadFeaClass.FindField(strFieldCode) < 0)
                {
                    MessageBox.Show("找不到铁路编码属性,请检查配置文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    pRoadFeaClass = null;
                    return;
                }
                frmQueryRoad fmQD = new frmQueryRoad(_pAppForm.MainForm, _AppHk.MapControl, pRoadFeaClass, strLayerName, strFieldName, strFieldCode, "铁 路 名:", "铁路编码:", "铁路查询");
                fmQD.WriteLog = this.WriteLog;
                fmQD.Show(_pAppForm.MainForm);
            }
            catch (Exception ex)
            {
                ErrorHandle.ShowFrmErrorHandle("提示", ex.Message);
            }
        }