📄 systemdialog.cpp
字号:
// SystemCount.cpp : implementation file
//
#include "stdafx.h"
#include "fert2000.h"
#include "SystemDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern bool bStopFlag;
extern SYSTEMCOUNT SystemCount;
extern RTU Rtus[MAX_RTU_NUM];
extern CHANNEL Channels[MAX_CHANNEL_NUM];
extern NetProcess NetProcess1;
extern CFert2000App theApp;
/////////////////////////////////////////////////////////////////////////////
// CSystemCount dialog
CSystemCount::CSystemCount(CWnd* pParent /*=NULL*/)
: CDialog(CSystemCount::IDD, pParent)
{
//{{AFX_DATA_INIT(CSystemCount)
m_ChannelNum = SystemCount .ChNum ;
m_RtuNum = SystemCount.RtuNum ;
//}}AFX_DATA_INIT
bRestartFlag = FALSE;
}
void CSystemCount::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSystemCount)
DDX_Text(pDX, IDC_CHANNEL_NUM, m_ChannelNum);
DDX_Text(pDX, IDC_RTU_NUM, m_RtuNum);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSystemCount, CDialog)
//{{AFX_MSG_MAP(CSystemCount)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSystemCount message handlers
BOOL CSystemCount::IsModified()
{
int SaveFlag=0;
UpdateData(TRUE);
char error=0;
if (m_RtuNum>MAX_RTU_NUM) {
MessageBox("RTU个数超过RTU最大数","警告",MB_OK);
error=1;
}
if (m_ChannelNum>MAX_CHANNEL_NUM) {
MessageBox("通道个数超过最大数","警告",MB_OK);
error=1;
}
if (error)
return false;
if ((SystemCount.RtuNum!=m_RtuNum) || (SystemCount.ChNum!=m_ChannelNum) )
{
bRestartFlag=1;
SaveFlag=1;
}
if (SaveFlag)
return TRUE;
else
return FALSE;
}
void CSystemCount::SaveSystemCount()
{
SystemCount.RtuNum=m_RtuNum;
SystemCount.ChNum=m_ChannelNum;
NetProcess1.SendSysParaFlag=1;
}
void CSystemCount::OnOK()
{
// TODO: Add extra validation here
if (IsModified()) {
if (MessageBox("参数已修改,是否存盘?","",MB_YESNO)==IDYES) {
SaveSystemCount();
}
theApp.WriteSystemCount ();
}
CDialog::OnOK();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -