using OrpaonEMS.App.Event;
using OrpaonEMS.Core.EventHandMsg;
using OrpaonEMS.Core.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OrpaonEMS.App.Models
{
///
/// 状态字的位报警内容
///
public class CoolBitAlarmInfo
{
public CoolBitAlarmInfo()
{
CurTimeInfo=new AlarmTimeInfo();
}
///
/// 发布报警信息
///
public event EventHandler PubCoolAlarmEventHandler;
private bool _State;
///
/// 报警状态
///
public bool State
{
get { return _State; }
set
{
if (_State != value && value == true)//报警发生
{
_State = value;
CurTimeInfo.StartTime = DateTime.Now;
//发布报警
PubCoolAlarmEventHandler(this, new CoolAlarmCellEventHandMsg() { State = true, Content = Content, Category = Category, CurTimeInfo = CurTimeInfo });
}
else if (_State != value && value == false)//报警消失
{
_State = value;
CurTimeInfo.EndTime = DateTime.Now;
//发布报警
PubCoolAlarmEventHandler(this, new CoolAlarmCellEventHandMsg() { State = false, Content = Content, Category = Category, CurTimeInfo = CurTimeInfo });
}
}
}
///
/// 报警时间信息
///
public AlarmTimeInfo CurTimeInfo { get; set; }
///
/// 类别
///
public ushort Category { get; set; }
///
/// Bit位置
///
public ushort BitIndex { get; set; }
///
/// 报警内容
///
public string Content { get; set; }
}
}