using CnasSynchrousModel; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace CNAS_DBSync { public partial class frmSplitParam : Form { public CnasConditionMapValue conditionvalue { get; set; } public frmSplitParam(CnasConditionMapValue conditionvalue) { InitializeComponent(); this.conditionvalue = conditionvalue; } private void btnOK_Click(object sender, EventArgs e) { if (this.txtPrama1.Text == "") { MessageBox.Show("参数1不能为空。"); return; } if (this.cbxPrama2.Text == "") { MessageBox.Show("参数2不能为空。"); return; } if (this.cbxPrama2.Text != "L" && this.cbxPrama2.Text != "R") { MessageBox.Show("参数2不符合规则,请重新选择。"); return; } this.conditionvalue.Value = "{"+ this.txtPrama1.Text + ","+ this.cbxPrama2.Text + "}"; this.DialogResult = DialogResult.OK; this.Close(); } private void frmSplitParam_Load(object sender, EventArgs e) { if (this.conditionvalue == null) return; if (this.conditionvalue.Value == null) return; if (this.conditionvalue.Condition != MapCondition.SubString) return; //根据旧值显示控件默认值 if (this.conditionvalue.Value.ToString()!= "") { string[] strConditionValues = this.conditionvalue.Value.ToString().Split(new string[] { "{",",","}" }, StringSplitOptions.RemoveEmptyEntries); if (strConditionValues.Length == 2) { this.txtPrama1.Text = strConditionValues[0]; this.cbxPrama2.Text = strConditionValues[1]; } } } } }