www.gusucode.com > VC++开发的ACD树形策略编辑器-源码程序 > VC++开发的ACD树形策略编辑器-源码程序/code/Switch.cpp

    // Switch.cpp : implementation file
// Download by http://www.NewXing.com

#include "stdafx.h"
#include "dsACD_IVR.h"
#include "Switch.h"

#include "dsACD_IVRDoc.h"
#include "dsACD_IVRView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSwitch dialog


CSwitch::CSwitch(CWnd* pParent /*=NULL*/)
	: CDialog(CSwitch::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSwitch)
	m_csCondition = _T("");
	m_csComment = _T("");
	//}}AFX_DATA_INIT
}


void CSwitch::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSwitch)
	DDX_CBString(pDX, IDC_SM_CONDITION, m_csCondition);
	DDX_Text(pDX, IDC_SM_COMMENT, m_csComment);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSwitch, CDialog)
	//{{AFX_MSG_MAP(CSwitch)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSwitch message handlers

BOOL CSwitch::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CComboBox *pCondition=(CComboBox *)GetDlgItem(IDC_SM_CONDITION);

	CString buf, csVariableName;
	m_pDsACD_IVRView->ReadVariable(buf);
	while (!buf.IsEmpty())
	{	csVariableName = buf.Left(buf.Find(";" ));
		pCondition->AddString(csVariableName);
		buf.Delete(0, buf.Find(";" )+1);
	}
	
	int nIndex = pCondition->SelectString(-1, m_csCondition);
	pCondition->SetCurSel(nIndex);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSwitch::DisplayDlg(dsACDObjectBase *pObj)
{
	dsSM_INFO * pSMInfo = (dsSM_INFO*) pObj->Read();
	m_csCondition = pSMInfo->Condition;
	m_csComment = pSMInfo->Comment;

	if(DoModal()==IDOK)
	{
		pSMInfo->Condition = m_csCondition;
		pSMInfo->Comment = m_csComment;
	}
	else 
		return;
}