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

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

#include "stdafx.h"
#include "dsACD_IVR.h"
#include "Match.h"

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

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

/////////////////////////////////////////////////////////////////////////////
// CMatch dialog


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


void CMatch::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMatch)
	DDX_Text(pDX, IDC_MM_COMMENT, m_csComment);
	DDX_CBString(pDX, IDC_MM_CONDITION, m_csCondition);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMatch, CDialog)
	//{{AFX_MSG_MAP(CMatch)
	ON_BN_CLICKED(IDC_RETURNVALUE, OnReturnvalue)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMatch message handlers
BOOL CMatch::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	CComboBox *pCondition=(CComboBox *)GetDlgItem(IDC_MM_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 CMatch::DisplayDlg(dsACDObjectBase *pObj)
{
	dsMM_INFO * pMMInfo = (dsMM_INFO*) pObj->Read();
	m_csCondition = pMMInfo->Condition;
	m_csComment = pMMInfo->Comment;

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

void CMatch::OnReturnvalue() 
{
	CReturnValue returnvalue;
	if(returnvalue.DoModal()!=IDOK) return ;
	m_csCondition = "“" + returnvalue.m_csReturn + "”";
	UpdateData(FALSE);
}