using OTSIncAReportApp.OTSSampleReportInfo;
using SourceGrid;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OTSIncAReportApp.OTSDataMgrFunction
{
///
/// 与属性Grid操作事件对应的事件类,在该类中实现属性Grid的操作方法实现
///
class ChangeGridCellValEvent : SourceGrid.Cells.Controllers.ControllerBase
{
#region 变量定义
///
/// 属性Grid类对象全局变量
///
OTSSourceGrid m_SourceGrid = null;
private const int Constant = 1;
#endregion
#region 构造函数
///
/// 构造函数
///
///
public ChangeGridCellValEvent(OTSSourceGrid SGrid)
{
m_SourceGrid = SGrid;
}
#endregion
#region 下拉框事件
///
/// 属性Grid的下拉框下拉完成后,触发的事件。SourceGrid的事件不是用delegate方法实现的,与dot net 的标准事件实现方式不同,需要在这里override才可以
///
///
///
public override void OnValueChanged(SourceGrid.CellContext sender, EventArgs e)
{
var changingItemId = (OTS_REPORT_PROP_GRID_ITEMS)m_SourceGrid.m_frmPropCondition.PropGrid.Rows[m_SourceGrid.m_ClickRow].Tag;
ConditionItem item = m_SourceGrid.m_frmPropCondition.m_CurrentConditions[changingItemId];
int selindex = 0;
OTS_ITEM_TYPES ValType = item.iItemValType;
switch (ValType)
{
case OTS_ITEM_TYPES.COMBO:
item.itemDisplayVal = (string)m_SourceGrid.m_frmPropCondition.PropGrid[m_SourceGrid.m_ClickRow, 2].Value;
selindex = item.comboDownList.IndexOf(item.itemDisplayVal.ToString());
item.itemVal = selindex;
break;
case OTS_ITEM_TYPES.DOUBLE:
var dValue = m_SourceGrid.m_frmPropCondition.PropGrid[m_SourceGrid.m_ClickRow, 2].Value;
double v = Convert.ToDouble(dValue);
item.itemDisplayVal = v;
item.itemVal = v;
break;
default:
break;
}
m_SourceGrid.m_frmPropCondition.DisCurrentPicProperty();
}
#endregion
}
///
/// 组合框类,与属性Grid关联
///
class ItemValueChange2 : SourceGrid.Cells.Controllers.ControllerBase
{
OTSSourceGrid m_SampleGrid = null;
public ItemValueChange2(OTSSourceGrid SGrid)
{
m_SampleGrid = SGrid;
}
public override void OnValueChanged(CellContext sender, EventArgs e)
{
//判断如果对选择颗粒,全部颗粒进行了重新选择的话
if (sender.Position.Row == 2)
m_SampleGrid.m_frmPropCondition.m_ReportApp.im_ParticlesGridDevidePage = null;//需要重新刷新颗粒列表
m_SampleGrid.m_frmPropCondition.ShowDataDiagram(m_SampleGrid.m_frmPropCondition.tabIndex);
//------------------------------------------------------------------------------------------------------------------
m_SampleGrid.m_ClickRow = sender.Position.Row;
if (m_SampleGrid.m_frmPropCondition.PropGrid.Rows[m_SampleGrid.m_ClickRow].Tag != null)
{
m_SampleGrid.m_frmPropCondition.m_ReportApp.m_RstWindow.SelectWorkSampleNode();
}
}
}
}