CNAS取数仪器端升级
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 line
2.3KB

  1. using CnasSynchrousModel;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace CNAS_DBSync
  11. {
  12. public partial class frmSplitParamnew : Form
  13. {
  14. public CnasConditionMapValue conditionvalue { get; set; }
  15. public frmSplitParamnew(CnasConditionMapValue conditionvalue)
  16. {
  17. InitializeComponent();
  18. this.conditionvalue = conditionvalue;
  19. }
  20. private void btnOK_Click(object sender, EventArgs e)
  21. {
  22. if (this.txtPrama1.Text == "")
  23. {
  24. MessageBox.Show("参数1不能为空。");
  25. return;
  26. }
  27. if (this.cbxPrama2.Text == "")
  28. {
  29. MessageBox.Show("参数2不能为空。");
  30. return;
  31. }
  32. //if (this.cbxPrama2.Text != "L" && this.cbxPrama2.Text != "R")
  33. //{
  34. // MessageBox.Show("参数2不符合规则,请重新选择。");
  35. // return;
  36. //}
  37. try
  38. {
  39. int values1 = Convert.ToInt32(this.txtPrama1.Text) - 1;
  40. int values2 = Convert.ToInt32(this.cbxPrama2.Text) ;
  41. this.conditionvalue.Value = "{"+ values1 + ","+ values2 + "}";
  42. this.DialogResult = DialogResult.OK;
  43. this.Close();
  44. }
  45. catch (Exception)
  46. {
  47. }
  48. }
  49. private void frmSplitParam_Load(object sender, EventArgs e)
  50. {
  51. if (this.conditionvalue == null) return;
  52. if (this.conditionvalue.Value == null) return;
  53. if (this.conditionvalue.Condition != MapCondition.SubString) return;
  54. //根据旧值显示控件默认值
  55. if (this.conditionvalue.Value.ToString()!= "")
  56. {
  57. string[] strConditionValues = this.conditionvalue.Value.ToString().Split(new string[] { "{",",","}" }, StringSplitOptions.RemoveEmptyEntries);
  58. if (strConditionValues.Length == 2)
  59. {
  60. this.txtPrama1.Text = strConditionValues[0];
  61. this.cbxPrama2.Text = strConditionValues[1];
  62. }
  63. }
  64. }
  65. }
  66. }