-
Notifications
You must be signed in to change notification settings - Fork 6
/
CustomSpectrometerModelDlg.cpp
62 lines (43 loc) · 1.39 KB
/
CustomSpectrometerModelDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// CustomSpectrometerModelDlg.cpp : implementation file
//
#include "stdafx.h"
#include "CustomSpectrometerModelDlg.h"
#include "resource.h"
// CustomSpectrometerModelDlg dialog
IMPLEMENT_DYNAMIC(CustomSpectrometerModelDlg, CDialog)
CustomSpectrometerModelDlg::CustomSpectrometerModelDlg(CWnd* pParent /*=NULL*/)
: CDialog(IDD_CONFIGURE_SPECTROMETERMODEL, pParent)
{
}
CustomSpectrometerModelDlg::~CustomSpectrometerModelDlg()
{
}
void CustomSpectrometerModelDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT_MODELNAME, m_modelName);
DDX_Text(pDX, IDC_EDIT_MAXIMUMINTENSITY, m_maxIntensity);
}
BEGIN_MESSAGE_MAP(CustomSpectrometerModelDlg, CDialog)
ON_BN_CLICKED(IDOK, &CustomSpectrometerModelDlg::OnBnClickedOk)
END_MESSAGE_MAP()
// CustomSpectrometerModelDlg message handlers
void CustomSpectrometerModelDlg::OnBnClickedOk()
{
// Validate the data
UpdateData(true);
if (m_modelName.GetLength() == 0)
{
MessageBox("The model name must not be empty.");
return;
}
double configuredMaxIntensity = atof(m_maxIntensity);
if (configuredMaxIntensity <= 0.0)
{
MessageBox("Invalid maximum intensity.");
return;
}
m_configuredSpectrometer.modelName = m_modelName;
m_configuredSpectrometer.maximumIntensityForSingleReadout = configuredMaxIntensity;
CDialog::OnOK();
}