📄 kreceivealarmpopdlg.cpp
字号:
// KReceiveAlarmPopDlg.cpp : implementation file
//
#include "stdafx.h"
#include "KReceiveAlarmPopDlg.h"
#include "../KJAlarmProtocol/KAlarmProtocol.h"
#include "../KylinSystem/KSystemInfo.h"
#include "KAlarmInfoDlg.h"
#include "KAlarmClientServer.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// KReceiveAlarmPopDlg dialog
KReceiveAlarmPopDlg::KReceiveAlarmPopDlg(CWnd* pParent /*=NULL*/)
: CDialog(KReceiveAlarmPopDlg::IDD, pParent)
, blAutoClose(false)
{
//{{AFX_DATA_INIT(KReceiveAlarmPopDlg)
m_AlarmState = _T("");
m_AlarmInfo = _T("");
//}}AFX_DATA_INIT
// AlarmProtocol->AddRef();
}
void KReceiveAlarmPopDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(KReceiveAlarmPopDlg)
DDX_Text(pDX, IDC_STATICAlARMTYPE, m_AlarmState);
DDX_Text(pDX, IDC_EDIT1, m_AlarmInfo);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(KReceiveAlarmPopDlg, CDialog)
//{{AFX_MSG_MAP(KReceiveAlarmPopDlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// KReceiveAlarmPopDlg message handlers
void KReceiveAlarmPopDlg::OnButton1()
{
// TODO: Add your control notification handler code here
//弹出察看事件详细信息对话框
KAlarmInfoDlg* AlarmInfoDlg=new KAlarmInfoDlg();
AlarmInfoDlg->SetAlarmEventID(EventID);
AlarmInfoDlg->Create(IDD_DIALOGALARMINFO,NULL);
AlarmInfoDlg->ShowWindow(SW_SHOW);
}
void KReceiveAlarmPopDlg::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
DestroyWindow();
}
BOOL KReceiveAlarmPopDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//判断报警类型
if(AlarmProtocol->Getstate()=="0") //报警未结束,发现报警
m_AlarmState="发现报警事件!";
else
m_AlarmState="报警已经结束!";
//添加报警信息
CString strInfo="";
strInfo="矿井名称:"+AlarmProtocol->GetEventMine()+"\r\n"
+"测点名称:"+AlarmProtocol->GetEventMonitorName()+"\r\n"
//+"测点值: "+AlarmProtocol->GetEventBeginValue()+"\r\n"
//+"事件类型:"+AlarmProtocol->GetEventType()+"\r\n"
+"联系电话:"+AlarmProtocol->GetTelephone()+"\r\n";
if(AlarmProtocol->Getstate()=="0")
{
strInfo+="报警开始时间:"+AlarmProtocol->GetEventBeginTime();
}
else
{
strInfo+="报警结束时间:"+AlarmProtocol->GetEventFinishTime();
}
m_AlarmInfo=strInfo;
if(KAlarmClientServer::Instance->mPlaySound && AlarmProtocol->GetEventFinishTime().IsEmpty())
{
if(!AlarmProtocol->GetAlarmSound().IsEmpty())
{
mAlarmPlayer.Play(AlarmProtocol->GetAlarmSound());
}
else
{
mAlarmPlayer.Play(_T("报警.wav"));
}
}
/*
if(AlarmProtocol->GetEventFinishTime().IsEmpty())
{
mAlarmPlayer.Play(_T("The Microsoft Sound.wav"));
}
//*/
UpdateData(false);
if(blAutoClose)
{
SetTimer(0, 5000, NULL);
}
this->SetWindowText(AlarmProtocol->GetAlarmName()+_T("报警提示信息"));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void KReceiveAlarmPopDlg::SetAlarmProtocol(KAlarmProtocol *Alarm)
{
AlarmProtocol=Alarm;
EventID=AlarmProtocol->GetEventID();
}
void KReceiveAlarmPopDlg::PostNcDestroy()
{
delete this;
}
void KReceiveAlarmPopDlg::OnTimer(UINT nIDEvent)
{
if(false && (KSystemInfo::IsWin2K() || KSystemInfo::IsWin98()))
{
AnimateWindow(m_hWnd, 500, AW_HIDE | AW_BLEND);
}
SendMessage(WM_CLOSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -