溼的飛灑范德薩飛
// AddNodeDlg.cpp : implementation file
//
#include "stdafx.h"
#include "ZCOMATest.h"
#include "AddNodeDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAddNodeDlg dialog
CAddNodeDlg::CAddNodeDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAddNodeDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CAddNodeDlg)
m_strNodeId = _T("40");
m_dwGuardTime = 1000;
m_dwRetryFactor = 3;
//}}AFX_DATA_INIT
}
void CAddNodeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAddNodeDlg)
DDX_Text(pDX, IDC_EDIT_NODEID, m_strNodeId);
DDX_Control(pDX, IDC_COMBO_GUARD_MODE, m_ComboGuardMode);
DDX_Text(pDX, IDC_EDIT_GUARD_TIME, m_dwGuardTime);
DDV_MinMaxUInt(pDX, m_dwGuardTime, 100, 65535);
DDX_Text(pDX, IDC_EDIT_RETRY_FACTOR, m_dwRetryFactor);
DDV_MinMaxUInt(pDX, m_dwRetryFactor, 0, 3);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAddNodeDlg, CDialog)
//{{AFX_MSG_MAP(CAddNodeDlg)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAddNodeDlg message handlers
BOOL CAddNodeDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
m_ComboGuardMode.InsertString(0, _T("節點守護"));
m_ComboGuardMode.InsertString(1, _T("心跳包"));
m_ComboGuardMode.InsertString(2, _T("禁用"));
m_ComboGuardMode.SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CAddNodeDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
ZeroMemory(&m_NodeConfig, sizeof(ZCOMA_NODECONFIG));
m_NodeConfig.dwNodeID = ZCOMA_HexStringToDWORD(m_strNodeId);
switch (m_ComboGuardMode.GetCurSel())
{
case 0: m_NodeConfig.dwGuardMode = GUARDING; break;
case 1: m_NodeConfig.dwGuardMode = HEARTBEAT; break;
case 2:
default: m_NodeConfig.dwGuardMode = DISABLE_GUARDING; break;
}
m_NodeConfig.dwGuardTime = m_dwGuardTime;
m_NodeConfig.dwRetryFactor = m_dwRetryFactor;
CDialog::OnOK();
}