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

#include "stdafx.h"
#include "demoSetAnswerTypeDlg.h"
#include "afxdialogex.h"
#include "HwmSdkAgent.h"

// demoSetAnswerTypeDlg 对话框

IMPLEMENT_DYNAMIC(demoSetAnswerTypeDlg, CDialogEx)

demoSetAnswerTypeDlg::demoSetAnswerTypeDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(IDD_SET_ANSWER_TYPE_DIALOG, pParent)
{

}

demoSetAnswerTypeDlg::~demoSetAnswerTypeDlg()
{
}

void demoSetAnswerTypeDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_COMBO_ANSWER_TYPE, m_typeCombo);
}

BOOL demoSetAnswerTypeDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    m_typeCombo.InsertString(0, _T("Normal"));
    m_typeCombo.InsertString(1, _T("Decline"));
    m_typeCombo.InsertString(2, _T("Answer" ));
    m_typeCombo.InsertString(3, _T("Custom"));
    m_typeCombo.SetCurSel(0);

    return TRUE;
}

BEGIN_MESSAGE_MAP(demoSetAnswerTypeDlg, CDialogEx)
    ON_BN_CLICKED(IDOK, &demoSetAnswerTypeDlg::OnBnClickedOk)
END_MESSAGE_MAP()


// demoSetAnswerTypeDlg 消息处理程序
void demoSetAnswerTypeDlg::OnBnClickedOk()
{
    const int type = m_typeCombo.GetCurSel();

    hwmsdkagent::HwmInComingAnswerTypeInfo info{};
    info.type = static_cast<hwmsdkagent::HwmInComingAnswerType>(type);

    int ret = hwmsdkagent::SetAnswerType(&info);;
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        AfxMessageBox(_T("set answer type error"));
        return;
    }
    CDialogEx::OnOK();
}