ChangeGridCellValEvent.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using OTSIncAReportApp.OTSSampleReportInfo;
  2. using SourceGrid;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace OTSIncAReportApp.OTSDataMgrFunction
  9. {
  10. /// <summary>
  11. /// 与属性Grid操作事件对应的事件类,在该类中实现属性Grid的操作方法实现
  12. /// </summary>
  13. class ChangeGridCellValEvent : SourceGrid.Cells.Controllers.ControllerBase
  14. {
  15. #region 变量定义
  16. /// <summary>
  17. /// 属性Grid类对象全局变量
  18. /// </summary>
  19. OTSSourceGrid m_SourceGrid = null;
  20. private const int Constant = 1;
  21. #endregion
  22. #region 构造函数
  23. /// <summary>
  24. /// 构造函数
  25. /// </summary>
  26. /// <param name="SGrid"></param>
  27. public ChangeGridCellValEvent(OTSSourceGrid SGrid)
  28. {
  29. m_SourceGrid = SGrid;
  30. }
  31. #endregion
  32. #region 下拉框事件
  33. /// <summary>
  34. /// 属性Grid的下拉框下拉完成后,触发的事件。SourceGrid的事件不是用delegate方法实现的,与dot net 的标准事件实现方式不同,需要在这里override才可以
  35. /// </summary>
  36. /// <param name="sender"></param>
  37. /// <param name="e"></param>
  38. public override void OnValueChanged(SourceGrid.CellContext sender, EventArgs e)
  39. {
  40. var changingItemId = (OTS_REPORT_PROP_GRID_ITEMS)m_SourceGrid.m_frmPropCondition.PropGrid.Rows[m_SourceGrid.m_ClickRow].Tag;
  41. ConditionItem item = m_SourceGrid.m_frmPropCondition.m_CurrentConditions[changingItemId];
  42. int selindex = 0;
  43. OTS_ITEM_TYPES ValType = item.iItemValType;
  44. switch (ValType)
  45. {
  46. case OTS_ITEM_TYPES.COMBO:
  47. item.itemDisplayVal = (string)m_SourceGrid.m_frmPropCondition.PropGrid[m_SourceGrid.m_ClickRow, 2].Value;
  48. selindex = item.comboDownList.IndexOf(item.itemDisplayVal.ToString());
  49. item.itemVal = selindex;
  50. break;
  51. case OTS_ITEM_TYPES.DOUBLE:
  52. var dValue = m_SourceGrid.m_frmPropCondition.PropGrid[m_SourceGrid.m_ClickRow, 2].Value;
  53. double v = Convert.ToDouble(dValue);
  54. item.itemDisplayVal = v;
  55. item.itemVal = v;
  56. break;
  57. default:
  58. break;
  59. }
  60. m_SourceGrid.m_frmPropCondition.DisCurrentPicProperty();
  61. }
  62. #endregion
  63. }
  64. /// <summary>
  65. /// 组合框类,与属性Grid关联
  66. /// </summary>
  67. class ItemValueChange2 : SourceGrid.Cells.Controllers.ControllerBase
  68. {
  69. OTSSourceGrid m_SampleGrid = null;
  70. public ItemValueChange2(OTSSourceGrid SGrid)
  71. {
  72. m_SampleGrid = SGrid;
  73. }
  74. public override void OnValueChanged(CellContext sender, EventArgs e)
  75. {
  76. //判断如果对选择颗粒,全部颗粒进行了重新选择的话
  77. if (sender.Position.Row == 2)
  78. m_SampleGrid.m_frmPropCondition.m_ReportApp.im_ParticlesGridDevidePage = null;//需要重新刷新颗粒列表
  79. m_SampleGrid.m_frmPropCondition.ShowDataDiagram(m_SampleGrid.m_frmPropCondition.tabIndex);
  80. //------------------------------------------------------------------------------------------------------------------
  81. m_SampleGrid.m_ClickRow = sender.Position.Row;
  82. if (m_SampleGrid.m_frmPropCondition.PropGrid.Rows[m_SampleGrid.m_ClickRow].Tag != null)
  83. {
  84. m_SampleGrid.m_frmPropCondition.m_ReportApp.m_RstWindow.SelectWorkSampleNode();
  85. }
  86. }
  87. }
  88. }