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

#include "stdafx.h"
#include "demo.h"
#include "demoSetIncomingAnserTypeDlg.h"
#include "afxdialogex.h"
#include "HwmSdkAgent.h"


// demoSetIncomingAnserTypeDlg 对话框

IMPLEMENT_DYNAMIC(demoSetIncomingAnserTypeDlg, CDialogEx)

demoSetIncomingAnserTypeDlg::demoSetIncomingAnserTypeDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(IDD_SET_INCOMING_ANSWER_TYPE, pParent)
    , m_Type(0)
{

}

demoSetIncomingAnserTypeDlg::~demoSetIncomingAnserTypeDlg()
{
}

void demoSetIncomingAnserTypeDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
    DDX_Radio(pDX, IDC_RADIO_NORMAL, m_Type);
	DDV_MinMaxInt(pDX, m_Type, 0, 2);
}


BEGIN_MESSAGE_MAP(demoSetIncomingAnserTypeDlg, CDialogEx)
    ON_BN_CLICKED(IDC_SET_CALL_INCOMING_ANSWER_TYPE, &demoSetIncomingAnserTypeDlg::OnBnClickedSetCallIncomingAnswerType)
    ON_BN_CLICKED(IDC_SET_CONF_INCOMING_ANSWER_TYPE, &demoSetIncomingAnserTypeDlg::OnBnClickedSetConfIncomingAnswerType)
END_MESSAGE_MAP()


// CSetIncomingAnserType 消息处理程序


void demoSetIncomingAnserTypeDlg::OnBnClickedSetCallIncomingAnswerType()
{
    UpdateData();
    hwmsdkagent::HWMInComingAnswerType type = (hwmsdkagent::HWMInComingAnswerType)m_Type;
    int ret = hwmsdkagent::SetCallIncomingAnswerResult(type);
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        AfxMessageBox(_T("Set Call Incoming Answer Result failed"));
    }
}


void demoSetIncomingAnserTypeDlg::OnBnClickedSetConfIncomingAnswerType()
{
    UpdateData();
    hwmsdkagent::HWMInComingAnswerType type = (hwmsdkagent::HWMInComingAnswerType)m_Type;
    int ret = hwmsdkagent::SetConfIncomingAnswerResult(type);
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        AfxMessageBox(_T("Set Conf Incoming Answer Result failed"));
    }
}


BOOL demoSetIncomingAnserTypeDlg::OnInitDialog()
{
    CDialogEx::OnInitDialog();

    // TODO:  在此添加额外的初始化
    m_Type = 0;
    UpdateData(FALSE);

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