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

#include "stdafx.h"
#include "demo.h"
#include "demoTools.h"
#include "demoSettingDlg.h"
#include "afxdialogex.h"
#include "HwmSdkAgent.h"
#include "demoRenameSelfDlg.h"
#include "demoEnablePairDlg.h"
#include "demoConfigDlg.h"
#include "demoEnableFeatureDlg.h"
#include "demoWaterMarkInfoDlg.h"
#include "demoSetSavePathDlg.h"
#include "demoUpdateCustomButtonInfo.h"
#include "demoConfigSettingWindowDlg.h"
#include "demoSetRawDataExternalConfigDlg.h"
#include "demoShowSettingWindowDlg.h"
#include "demoDisableVoicePromptsDlg.h"
#include "demoSharePermission.h"
#include "demoGetSavePathDlg.h"
#include "demoSetLogPathDlg.h"
#include "demoSetAnswerTypeDlg.h"
#include "demoSetAvatarStyleDlg.h"
#include "demoSetDefaultVirtualBg.h"

// demoSettingDlg 对话框

IMPLEMENT_DYNAMIC(demoSettingDlg, CDialogEx)

demoSettingDlg::demoSettingDlg(CWnd* pParent /*=NULL*/)
	: CDialogEx(IDD_SETTING_DIALOG, pParent)
    , m_customizedLangcode(_T(""))
    , m_langCode(0)
{

}

demoSettingDlg::~demoSettingDlg()
{
}

void demoSettingDlg::DoDataExchange(CDataExchange* pDX)
{
    CDialogEx::DoDataExchange(pDX);
    DDX_Text(pDX, IDC_CUSTOMIZED_LANGCODE, m_customizedLangcode);
    DDX_Text(pDX, IDC_EDIT_LAN_CODE, m_langCode);
	DDV_MinMaxInt(pDX, m_langCode, 0, 4);
}


BEGIN_MESSAGE_MAP(demoSettingDlg, CDialogEx)
    ON_BN_CLICKED(IDC_BUTTON_SET_LAN_CODE, &demoSettingDlg::OnBnClickedButtonSetLanCode)
    ON_BN_CLICKED(IDC_BUTTON_GO_CONFIG, &demoSettingDlg::OnBnClickedButtonGoConfig)
    ON_BN_CLICKED(IDC_BUTTON_GO_ENABLE_FEATURE, &demoSettingDlg::OnBnClickedButtonGoEnableFeature)
    ON_BN_CLICKED(IDC_BUTTON_RENAME, &demoSettingDlg::OnBnClickedButtonRename)
    ON_BN_CLICKED(IDC_BUTTON_ENABLE_PAIR, &demoSettingDlg::OnBnClickedButtonEnablePair)
    ON_BN_CLICKED(IDC_BUTTON_SET_WATERMARK, &demoSettingDlg::OnBnClickedButtonSetWatermark)
    ON_BN_CLICKED(IDC_BUTTON_SET_SAVE_PATH, &demoSettingDlg::OnBnClickedButtonSetSavePath)
    ON_BN_CLICKED(IDC_BUTTON_SHOW_MEETING_WINDOW, &demoSettingDlg::OnBnClickedButtonShowMeetingWindow)
    ON_BN_CLICKED(IDC_GET_ATTENDEELIST, &demoSettingDlg::OnBnClickedButtonGetAttendeelist)
    ON_BN_CLICKED(IDC_GET_AUDIENCELIST, &demoSettingDlg::OnBnClickedButtonGetAudienceList)
    ON_BN_CLICKED(IDC_BUTTON_UPDATE_CUSTON_BUTTON_INFO, &demoSettingDlg::OnBnClickedButtonUpdateCustonButtonInfo)
    ON_BN_CLICKED(IDC_BUTTON_CONFIG_SETTING_WINDOW, &demoSettingDlg::OnBnClickedButtonConfigSettingWindow)
    ON_BN_CLICKED(IDC_BUTTON_SET_RAW_DATA_EXTERANL_CONFIG, &demoSettingDlg::OnBnClickedButtonE2EE)
    ON_BN_CLICKED(IDC_BUTTON_SHOW_SETTING_WINDOW, &demoSettingDlg::OnBnClickedButtonShowSettingWindow)
    ON_BN_CLICKED(IDC_BUTTON_DISABLE_VOICE_PROMPTS, &demoSettingDlg::OnBnClickedButtonDisableVoicePrompts)
    ON_BN_CLICKED(IDC_BUTTON_SHARE_PERMISSION, &demoSettingDlg::OnBnClickedButtonSharePermission)
    ON_BN_CLICKED(IDC_GET_SAVE_PATH, &demoSettingDlg::OnBnClickedGetSavePath)
    ON_BN_CLICKED(IDC_BUTTON_SET_LOG_PATH, &demoSettingDlg::OnBnClickedButtonSetLogPath)
    ON_BN_CLICKED(IDC_BUTTON_SET_ANSWER_TYPE, &demoSettingDlg::OnBnClickedButtonSetAnswerType)
    ON_BN_CLICKED(IDC_BUTTON_SET_AVATAR_STYLE, &demoSettingDlg::OnBnClickedButtonSetAvatarStyle)
    ON_BN_CLICKED(IDC_DEFAULT_VIRTUAL_BACKGROUND, &demoSettingDlg::OnBnClickedDefaultVirtualBackground)
END_MESSAGE_MAP()


// demoSettingDlg 消息处理程序

/**
* 修改语言
*/
void demoSettingDlg::OnBnClickedButtonSetLanCode()
{
    UpdateData(1);
    m_customizedLangcode;
    
    int ret = hwmsdkagent::SetLanguageWithCode((hwmsdkagent::HwmLanguage)m_langCode, CTools::UNICODE2UTF(m_customizedLangcode.GetBuffer()).c_str());
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        CTools::OutputRetStr("SetLanguage error");
    }
}

/**
* 打开配置窗口
*/
void demoSettingDlg::OnBnClickedButtonGoConfig()
{
    demoConfigDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}

/**
* 打开功能开关设置窗口
*/
void demoSettingDlg::OnBnClickedButtonGoEnableFeature()
{
    demoEnableFeatureDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}

/**
* 设置会场名
*/
void demoSettingDlg::OnBnClickedButtonRename()
{
    //设置本人的会场名
    demoRenameSelfDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}

/**
* 打开配对功能开关窗口
*/
void demoSettingDlg::OnBnClickedButtonEnablePair()
{
    //开启或关闭配对功能弹框
    demoEnablePairDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}


void demoSettingDlg::OnBnClickedButtonSetWatermark()
{
    //设置水印注入信息窗口
    demoWaterMarkInfoDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}

// 设置保存路径接口
void demoSettingDlg::OnBnClickedButtonSetSavePath()
{
    demoSetSavePathDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}

void demoSettingDlg::OnBnClickedButtonShowMeetingWindow()
{
    int ret = hwmsdkagent::ShowMeetingWindow();
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        CTools::OutputRetStr("ShowMeetingWindow error" );
    }
}

void demoSettingDlg::OnBnClickedButtonGetAttendeelist()
{
    int ret = hwmsdkagent::GetAttendeeList();
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        CTools::OutputRetStr("GetAttendeelist error " + std::to_string(ret));
    }
}

void demoSettingDlg::OnBnClickedButtonGetAudienceList()
{
    int ret = hwmsdkagent::GetAudienceList();
    if (hwmsdk::HWM_COMMON_SUCCESS != ret)
    {
        CTools::OutputRetStr("GetAudienceList error " + std::to_string(ret));
    }
}

void demoSettingDlg::OnBnClickedButtonUpdateCustonButtonInfo()
{
    demoUpdateCustomButtonInfo dlg;
    INT_PTR nResponse = dlg.DoModal();
}


void demoSettingDlg::OnBnClickedButtonConfigSettingWindow()
{
    demoConfigSettingWindowDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}

// 设置端到端音视频加解密窗口
void demoSettingDlg::OnBnClickedButtonE2EE()
{
    demoSetRawDataExternalConfigDlg setRawDataExternalConfigDlg;
    INT_PTR nResponse = setRawDataExternalConfigDlg.DoModal();
}


void demoSettingDlg::OnBnClickedButtonShowSettingWindow()
{
    // TODO: 在此添加控件通知处理程序代码
    demoShowSettingWindowDlg showSettingWindowDlg;
    INT_PTR nResponse = showSettingWindowDlg.DoModal();
}

void demoSettingDlg::OnBnClickedButtonDisableVoicePrompts()
{
    demoDisableVoicePromptsDlg disableVoicePromptsDlg;
    INT_PTR nResponse = disableVoicePromptsDlg.DoModal();
}

void demoSettingDlg::OnBnClickedButtonSharePermission()
{
    demoSharePermission sharePermissionDlg;
    sharePermissionDlg.DoModal();
}


void demoSettingDlg::OnBnClickedGetSavePath()
{
    demoGetSavePathDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}

void demoSettingDlg::OnBnClickedButtonSetLogPath()
{
    demoSetLogPathDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}

void demoSettingDlg::OnBnClickedButtonSetAnswerType()
{
    demoSetAnswerTypeDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}


void demoSettingDlg::OnBnClickedButtonSetAvatarStyle()
{
    demoSetAvatarStyleDlg dlg;
    INT_PTR nResponse = dlg.DoModal();
}


void demoSettingDlg::OnBnClickedDefaultVirtualBackground()
{
    demoSetDefaultVirtualBg dlg;
    dlg.DoModal();
}
