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

#include "stdafx.h"
#include "demoSetSavePathDlg.h"
#include "afxdialogex.h"
#include "resource.h"
#include "demoTools.h"
#include "HwmSdkAgent.h"

// demoSetSavePathDlg 对话框

IMPLEMENT_DYNAMIC(demoSetSavePathDlg, CDialogEx)

demoSetSavePathDlg::demoSetSavePathDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(IDD_SET_SAVE_PATH_DIALOG, pParent)
{

}

demoSetSavePathDlg::~demoSetSavePathDlg()
{
}

void demoSetSavePathDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
    DDX_Control(pDX, IDC_EDIT_SAVE_PATH_TYPE, m_saveTypeEdit);
    DDX_Control(pDX, IDC_EDIT_SAVE_PATH, m_savePathEdit);
}


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


// demoSetSavePathDlg 消息处理程序


void demoSetSavePathDlg::OnBnClickedOk()
{
    CString typeCString;
    m_saveTypeEdit.GetWindowText(typeCString);
    int type = _ttoi(typeCString);
    CString savePathCString;
    m_savePathEdit.GetWindowText(savePathCString);
    string savePath = CTools::UNICODE2UTF(savePathCString.GetString());
    int ret = hwmsdkagent::SetUserSavePath((hwmsdkagent::HWMSavePathType)type, (char*)savePath.c_str());
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        CTools::OutputRetStr("SetUserSavePath error");
        return;
    }
    CDialogEx::OnOK();
}
