Example #1
0
        private void ShowForm(string type, string remark)
        {
            DataGridViewRow dr = dg1.CurrentRow;

            if (!string.IsNullOrEmpty(_editForm) && _editForm != "0")
            {
                //利用反射实例化窗口
                Type t = Type.GetType("xkfy_mod.Personality." + _editForm);//窗体名要加上程序集名称
                if (t == null)
                {
                    return;
                }
                Form form;
                if (type == "EditGroup")
                {
                    if (dr == null)
                    {
                        return;
                    }
                    DataRow[] talkGroupRows = null;
                    switch (_tbName)
                    {
                    case Const.TalkManager:
                        talkGroupRows = DataHelper.XkfyData.Tables[_tbName].Select($"iQGroupID='{dr.Cells["iQGroupID"].Value}'", "indexSn Asc");
                        break;

                    case Const.MapTalkManager:
                        talkGroupRows = DataHelper.XkfyData.Tables[_tbName].Select($"sGroupID='{dr.Cells["sGroupID"].Value}'", "indexSn Asc");
                        break;
                    }
                    form = (Form)Activator.CreateInstance(t, talkGroupRows, type);
                }
                else
                {
                    form = (Form)Activator.CreateInstance(t, dr, type);
                }
                form.Text = remark + _tbName;
                form.ShowDialog();
            }
            else
            {
                FormData fd = new FormData
                {
                    Dr               = dr,
                    Type             = type,
                    DictTableExplain = _dictTableExplain,
                    TableName        = _tbName,
                    ConfigKeyName    = _configKey
                };
                AlmightyEdit ae = new AlmightyEdit(fd)
                {
                    Text = remark + _tbName
                };
                ae.Show();
            }
        }
Example #2
0
        private void ShowForm(string type)
        {
            if (this.dg1.CurrentRow == null)
            {
                MessageBox.Show("请先选择一行");
                return;
            }

            if (!string.IsNullOrEmpty(_editForm) && _editForm != "0")
            {
                string          tableName = _myConfig.MainDtName;
                DataGridViewRow dr        = this.dg1.CurrentRow;

                //利用反射实例化窗口
                Type t = Type.GetType("xkfy_mod." + _editForm);//窗体名要加上程序集名称
                if (t == null)
                {
                    return;
                }

                Form form;
                if (!string.IsNullOrEmpty(_myConfig.IsDlcFile) && _myConfig.IsDlcFile == "YES")
                {
                    form = (Form)Activator.CreateInstance(t, new object[] { dr, type, tableName });
                }
                else
                {
                    form = (Form)Activator.CreateInstance(t, new object[] { dr, type });
                }

                form.Text = "编辑" + _tbName;
                form.ShowDialog();
            }
            else
            {
                DataGridViewRow dr = this.dg1.CurrentRow;
                AlmightyEdit    ae = new AlmightyEdit(dr, _tbName, type, _fileType);
                ae.Text = "编辑" + _tbName;
                ae.Show();
            }
        }