添加项目文件。
This commit is contained in:
89
EleBox.App/Com/StateModel.cs
Normal file
89
EleBox.App/Com/StateModel.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DynStatDisk.App.Com
|
||||
{
|
||||
public class StateModel
|
||||
{
|
||||
public delegate void StateSglDelegate(bool UpdateValue, string Name, string Category);
|
||||
public event StateSglDelegate StateSglSglEvent;
|
||||
|
||||
public StateModel(string name, string category, List<BitStateSgl> listBitStateSgl)
|
||||
{
|
||||
Name = name;
|
||||
Category = category;
|
||||
ListBitStateSgl = listBitStateSgl;
|
||||
}
|
||||
|
||||
public StateModel(string name, string category, List<IntStateSgl> listIntStateSgl)
|
||||
{
|
||||
Name = name;
|
||||
Category = category;
|
||||
ListIntStateSgl = listIntStateSgl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public string Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 复位状态
|
||||
/// </summary>
|
||||
public void ResetResult()
|
||||
{
|
||||
_Result = false;
|
||||
}
|
||||
|
||||
private bool _Result;
|
||||
/// <summary>
|
||||
/// 结果判断
|
||||
/// </summary>
|
||||
public bool Result
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Result;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value != _Result && value == true)
|
||||
{
|
||||
_Result = value;
|
||||
StateSglSglEvent(true, Name, Category);//开始动作
|
||||
}
|
||||
else if (value != _Result && value == false)
|
||||
{
|
||||
_Result = false;
|
||||
//StateSglSglEvent(false, Name, Category);//开始动作
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 临时暂存的结果
|
||||
/// </summary>
|
||||
public bool TempBitValue { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 信号状态集合 Bool
|
||||
/// </summary>
|
||||
public List<BitStateSgl> ListBitStateSgl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 信号状态集合 Int
|
||||
/// </summary>
|
||||
public List<IntStateSgl> ListIntStateSgl { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user