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

#include "stdafx.h"
#include "YAServer.h"
#include "LogSetting.h"
#include "afxdialogex.h"

extern BOOL m_log_sys_status;

// CLogSetting 对话框

IMPLEMENT_DYNAMIC(CLogSetting, CDialogEx)

CLogSetting::CLogSetting(CWnd* pParent /*=NULL*/)
	: CDialogEx(CLogSetting::IDD, pParent)
	//, m_log_sys_status(FALSE)
	, m_log_raw_data(FALSE)
	, m_log_parse_data(FALSE)
	, m_log_send_package(FALSE)
	, m_log_recv_package(FALSE)
	, m_log_locate_data(FALSE)
{
	m_log_sys_status = theApp.log_sys_status;
	m_log_raw_data = theApp.log_raw_data;
	m_log_parse_data = theApp.log_parse_data;
	m_log_recv_package = theApp.log_recv_package;
	m_log_send_package = theApp.log_send_package;
	m_log_locate_data  = theApp.log_locate_data;
}

CLogSetting::~CLogSetting()
{
}

void CLogSetting::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Check(pDX, IDC_SYSTEM_STATUS, m_log_sys_status);
	DDX_Check(pDX, IDC_RAW_DATA, m_log_raw_data);
	DDX_Check(pDX, IDC_FORMAT_DATA, m_log_parse_data);
	DDX_Check(pDX, IDC_SEND_DATA_PACKET, m_log_send_package);
	DDX_Check(pDX, IDC_RECV_DATA_PACKET, m_log_recv_package);
	DDX_Check(pDX, IDC_LOCATE_DATA, m_log_locate_data);
}


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


// CLogSetting 消息处理程序


void CLogSetting::OnBnClickedOk()
{
	UpdateData(TRUE);
	theApp.log_sys_status = m_log_sys_status;
	theApp.log_raw_data = m_log_raw_data;
	theApp.log_parse_data = m_log_parse_data;
	theApp.log_recv_package = m_log_recv_package;
	theApp.log_send_package = m_log_send_package;
	theApp.log_locate_data  = m_log_locate_data;

	theApp.save_log_conf();
	CDialogEx::OnOK();
}


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

	// TODO:  在此添加额外的初始化
	((CButton*)GetDlgItem(IDC_SYSTEM_STATUS))->SetCheck(m_log_sys_status);
	((CButton*)GetDlgItem(IDC_RAW_DATA))->SetCheck(m_log_raw_data);
	((CButton*)GetDlgItem(IDC_FORMAT_DATA))->SetCheck(m_log_parse_data);
	((CButton*)GetDlgItem(IDC_SEND_DATA_PACKET))->SetCheck(m_log_send_package);
	((CButton*)GetDlgItem(IDC_RECV_DATA_PACKET))->SetCheck(m_log_recv_package);
	((CButton*)GetDlgItem(IDC_LOCATE_DATA))->SetCheck(m_log_locate_data);

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