a
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
// DelElectrode.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "geomative.h"
|
||||
#include "DelElectrode.h"
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDelElectrode dialog
|
||||
extern void SplitterString(CStringArray &szArray,const CString& szSource, const CString& szSplitter);
|
||||
extern int g_iUILanguage;
|
||||
|
||||
CDelElectrode::CDelElectrode(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CDelElectrode::IDD, pParent)
|
||||
{
|
||||
//{{AFX_DATA_INIT(CDelElectrode)
|
||||
m_strDelElectID = _T("");
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
|
||||
void CDelElectrode::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CDelElectrode)
|
||||
DDX_Text(pDX, IDC_EDIT_ELECTRODE_ID, m_strDelElectID);
|
||||
DDV_MaxChars(pDX, m_strDelElectID, 200);
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDelElectrode, CDialog)
|
||||
//{{AFX_MSG_MAP(CDelElectrode)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CDelElectrode message handlers
|
||||
|
||||
BOOL CDelElectrode::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
void CDelElectrode::OnOK()
|
||||
{
|
||||
// TODO: Add extra validation here
|
||||
if (!UpdateData(TRUE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!CheckIDValidity())
|
||||
{
|
||||
return;
|
||||
}
|
||||
CDialog::OnOK();
|
||||
}
|
||||
|
||||
bool CDelElectrode::CheckIDValidity()
|
||||
{
|
||||
if (m_strDelElectID.IsEmpty())
|
||||
{
|
||||
if (LANG_ZHCN == g_iUILanguage)
|
||||
AfxMessageBox(_T("电极序号不能为空."));
|
||||
else
|
||||
MessageBoxEx(NULL, _T("Electrode index can not be empty!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||||
return false;
|
||||
}
|
||||
m_strDelElectID.TrimLeft();//删除左边的空格
|
||||
m_strDelElectID.TrimRight();//删除右边的空格
|
||||
int iLen = m_strDelElectID.GetLength();
|
||||
TCHAR ch;
|
||||
for (int i = 0; i < iLen; i++)
|
||||
{
|
||||
ch = m_strDelElectID.GetAt(i);
|
||||
if ((ch != _T(',')) && (ch != _T('.')) && (ch < _T('0') || ch > _T('9')))
|
||||
{
|
||||
if (LANG_ZHCN == g_iUILanguage)
|
||||
AfxMessageBox(_T("输入参数错误,请输入数字,数字之间用逗号分隔."));
|
||||
else
|
||||
MessageBoxEx(NULL, _T("Input parameter error! \r\nPlease enter into number (separated by comma)."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDelElectrode::GetElectrodeIDInfo(STDelElectInfo &stDelInfo)
|
||||
{
|
||||
stDelInfo.vtElectID.clear();
|
||||
CStringArray strArray;
|
||||
strArray.RemoveAll();
|
||||
SplitterString(strArray, m_strDelElectID, _T(","));
|
||||
CString strVal = _T("");
|
||||
float fID = 0;
|
||||
for (int i = 0; i < strArray.GetSize(); i++)
|
||||
{
|
||||
strVal = strArray.GetAt(i);
|
||||
fID = atof(strVal);
|
||||
stDelInfo.vtElectID.push_back(fID);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user