// DialogSysParaSet.cpp : 实现文件
//

#include "stdafx.h"
#include "Verbpo.h"
#include "DialogSysParaSet.h"
#include "afxdialogex.h"


// CDialogSysParaSet 对话框

IMPLEMENT_DYNAMIC(CDialogSysParaSet, CDialogEx)

CDialogSysParaSet::CDialogSysParaSet(CWnd* pParent /*=NULL*/)
	: CDialogEx(CDialogSysParaSet::IDD, pParent)
{

}

CDialogSysParaSet::~CDialogSysParaSet()
{
}

void CDialogSysParaSet::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COMBO_SYS_PARA_ALM_THRESHOLD_SHOW, m_CComboBoxAlmThresholdShow);
	DDX_Control(pDX, IDC_COMBO_SYS_PARA_ALM_TIME, m_CComboBoxAlmTime);
	DDX_Control(pDX, IDC_COMBO_SYS_PARA_ALM_TYPE, m_CComboBoxAlmType);
	DDX_Control(pDX, IDC_COMBO_SYS_PARA_ALM_VOL, m_CComboBoxAlmVol);
}

BOOL CDialogSysParaSet::OnInitDialog()
{
	CString a_cs;
	CDialogEx::OnInitDialog();

	m_CComboBoxAlmThresholdShow.AddString(CString(_T("关")));
	m_CComboBoxAlmThresholdShow.AddString(CString(_T("开")));
	m_CComboBoxAlmThresholdShow.SetCurSel(0);

	m_CComboBoxAlmTime.AddString(CString(_T("1分钟")));
	m_CComboBoxAlmTime.AddString(CString(_T("2分钟")));
	if (theApp.m_Data->m_i32ParaAlmTime == 60)
	{
		m_CComboBoxAlmTime.SetCurSel(0);
	} 
	else
	{
		m_CComboBoxAlmTime.SetCurSel(1);
	}
	

	m_CComboBoxAlmType.AddString(CString(_T("非栓锁")));
	m_CComboBoxAlmType.AddString(CString(_T("栓锁")));
	m_CComboBoxAlmType.SetCurSel(0);

	m_CComboBoxAlmVol.AddString(CString(_T("1")));
	m_CComboBoxAlmVol.AddString(CString(_T("2")));
	m_CComboBoxAlmVol.AddString(CString(_T("3")));
	m_CComboBoxAlmVol.AddString(CString(_T("4")));
	m_CComboBoxAlmVol.SetCurSel(theApp.m_Data->m_i32ParaAlmVol);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常:  OCX 属性页应返回 FALSE

}

BEGIN_MESSAGE_MAP(CDialogSysParaSet, CDialogEx)
	ON_WM_DESTROY()
	ON_BN_CLICKED(IDOK, &CDialogSysParaSet::OnBnClickedOk)
	ON_CBN_SELCHANGE(IDC_COMBO_SYS_PARA_ALM_THRESHOLD_SHOW, &CDialogSysParaSet::OnCbnSelchangeComboSysParaAlmThresholdShow)
	ON_CBN_SELCHANGE(IDC_COMBO_SYS_PARA_ALM_TIME, &CDialogSysParaSet::OnCbnSelchangeComboSysParaAlmTime)
	ON_CBN_SELCHANGE(IDC_COMBO_SYS_PARA_ALM_TYPE, &CDialogSysParaSet::OnCbnSelchangeComboSysParaAlmType)
	ON_CBN_SELCHANGE(IDC_COMBO_SYS_PARA_ALM_VOL, &CDialogSysParaSet::OnCbnSelchangeComboSysParaAlmVol)
END_MESSAGE_MAP()


// CDialogSysParaSet 消息处理程序

void CDialogSysParaSet::OnDestroy()
{
	CDialogEx::OnDestroy();

	// TODO:  在此处添加消息处理程序代码

}

void CDialogSysParaSet::OnBnClickedOk()
{
	// TODO:  在此添加控件通知处理程序代码
	CDialogEx::OnOK();
}


void CDialogSysParaSet::OnCbnSelchangeComboSysParaAlmThresholdShow()
{
	// TODO:  在此添加控件通知处理程序代码
}


void CDialogSysParaSet::OnCbnSelchangeComboSysParaAlmTime()
{
	// TODO:  在此添加控件通知处理程序代码
	if (m_CComboBoxAlmTime.GetCurSel()==0)
	{
		theApp.m_Data->m_i32ParaAlmTime = 60;
	}
	else
	{
		theApp.m_Data->m_i32ParaAlmTime = 120;
	}
	theApp.m_Data->m_i32ParaAlmTime = m_CComboBoxAlmTime.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_AlmTime(theApp.m_Data->m_i32ParaAlmTime);
}


void CDialogSysParaSet::OnCbnSelchangeComboSysParaAlmType()
{
	// TODO:  在此添加控件通知处理程序代码
	
	if (m_CComboBoxAlmType.GetCurSel()==0)
	{
		//报警 从 栓锁切换到非 栓锁
		theApp.m_i32AlmLock = 0;
		theApp.m_Data->Del_ECG_Alm_ALL(ALM_TYPE_ECG, DEL_NOT_TRIGGER);

		theApp.m_Data->Del_Resp_Temp_Alm_ALL(ALM_TYPE_RESP, DEL_NOT_TRIGGER);
		theApp.m_Data->Del_Resp_Temp_Alm_ALL(ALM_TYPE_TEMP, DEL_NOT_TRIGGER);

		theApp.m_Data->Del_Oxy_NIBP_Alm_ALL(ALM_TYPE_OXY, DEL_NOT_TRIGGER);
		theApp.m_Data->Del_Oxy_NIBP_Alm_ALL(ALM_TYPE_NIBP, DEL_NOT_TRIGGER);
	}
	else
	{
		theApp.m_i32AlmLock = 1;
	}
}


void CDialogSysParaSet::OnCbnSelchangeComboSysParaAlmVol()
{
	// TODO:  在此添加控件通知处理程序代码

	
	theApp.m_Data->m_i32ParaAlmVol = m_CComboBoxAlmVol.GetCurSel();
	theApp.m_Data->m_CParameterSet.set_AlmVol(theApp.m_Data->m_i32ParaAlmVol);
	switch (theApp.m_Data->m_i32ParaAlmVol)
	{
	case 0:
		theApp.m_Data->m_i32AlmVol = -1398;
		break;

	case 1:
		theApp.m_Data->m_i32AlmVol = -602;
		break;

	case 2:
		theApp.m_Data->m_i32AlmVol = -194;
		break;

	case 3:
		theApp.m_Data->m_i32AlmVol = 0;
		break;
	}
}
