V1版本
This commit is contained in:
@@ -1,77 +0,0 @@
|
||||
using HslCommunication;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using Prism.Mvvm;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// 字节变量模型
|
||||
/// </summary>
|
||||
public class ByteTag<T> /*: BaseTag*/
|
||||
{
|
||||
///// <summary>
|
||||
///// 实例化函数
|
||||
///// </summary>
|
||||
///// <param name="name"></param>
|
||||
///// <param name="enName"></param>
|
||||
///// <param name="unit"></param>
|
||||
///// <param name="tagType"></param>
|
||||
//public ByteTag(string name, string enName, string unit, ComEnum.TagType tagType, T registerValue) : base(name, enName, unit, tagType)
|
||||
//{
|
||||
// //IRegisterValue<short> registerValue = new RegisterValue<short>();
|
||||
|
||||
// //RtValue = registerValue;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
public string Name { get; set; }
|
||||
//T BaseTag.RtValue { get; set; }
|
||||
|
||||
//private IRegisterValue<T> _RtValue;
|
||||
///// <summary>
|
||||
///// 实时值
|
||||
///// </summary>
|
||||
//public override IRegisterValue<T> RtValue
|
||||
//{
|
||||
// get { return _RtValue; }
|
||||
// set { _RtValue = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
//public override IRegisterValue<T> RtValue { set => throw new NotImplementedException(); }
|
||||
|
||||
//private OperateResult<byte> _OperateResultSource;
|
||||
///// <summary>
|
||||
///// 原始值
|
||||
///// </summary>
|
||||
//public override OperateResult<byte> OperateResultSource
|
||||
//{
|
||||
// get { return _OperateResultSource; }
|
||||
// set
|
||||
// {
|
||||
// if (value != _OperateResultSource)
|
||||
// {
|
||||
// RtValue = value.Content;
|
||||
// }
|
||||
// _OperateResultSource = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
//private DataType _DataTypeInfo;
|
||||
///// <summary>
|
||||
///// 数据类型信息
|
||||
///// </summary>
|
||||
//public override DataType DataTypeInfo
|
||||
//{
|
||||
// get { return _DataTypeInfo; }
|
||||
// set { _DataTypeInfo = value; RaisePropertyChanged(); }
|
||||
//}
|
||||
|
||||
//public override IRegisterValue<T> RtValue { set => throw new NotImplementedException(); }
|
||||
|
||||
//public override IRegisterValue<T> RtValue => throw new NotImplementedException();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,4 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
@@ -21,5 +15,75 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// 英文名称
|
||||
/// </summary>
|
||||
string EnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称 无单位中文名称
|
||||
/// </summary>
|
||||
string NameNoUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 分组
|
||||
/// </summary>
|
||||
string Group { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
string? Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工程值
|
||||
/// </summary>
|
||||
double EngValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工程值的字符串
|
||||
/// </summary>
|
||||
string EngValueStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MV
|
||||
/// </summary>
|
||||
double MVValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大值
|
||||
/// </summary>
|
||||
double MaxValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小值
|
||||
/// </summary>
|
||||
double MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值类型
|
||||
/// </summary>
|
||||
Type ValueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
string PVAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Index
|
||||
/// </summary>
|
||||
string Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 精度
|
||||
/// </summary>
|
||||
short Precision { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 小数点
|
||||
/// </summary>
|
||||
short DecimalPoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为仪表参数
|
||||
/// </summary>
|
||||
bool IsMeter { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
using HslCommunication;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// 实时数据模型
|
||||
/// </summary>
|
||||
public class RtDataModel : TagInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="enName"></param>
|
||||
/// <param name="unit"></param>
|
||||
/// <param name="tagType"></param>
|
||||
public RtDataModel(string name, string enName, string unit, TagType tagType, bool IsChart) : base(name, enName, unit, tagType)
|
||||
{
|
||||
IsChartShow = IsChart;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分类信息
|
||||
/// </summary>
|
||||
public string Category { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 通信结果 实时值
|
||||
/// </summary>
|
||||
private OperateResult<Int16> _OperateResultRtValue;
|
||||
public OperateResult<Int16> OperateResultRtValue
|
||||
{
|
||||
get { return _OperateResultRtValue; }
|
||||
set { _OperateResultRtValue = value; }
|
||||
}
|
||||
|
||||
private double _RtValue;
|
||||
/// <summary>
|
||||
/// 实时值
|
||||
/// </summary>
|
||||
public double RtValue
|
||||
{
|
||||
get { return _RtValue; }
|
||||
set { _RtValue = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实时值的地址
|
||||
/// </summary>
|
||||
public string RtValueAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否曲线显示
|
||||
/// </summary>
|
||||
public bool IsChartShow { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
using HslCommunication;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
///// <summary>
|
||||
///// 字变量模型
|
||||
///// </summary>
|
||||
//public class ShortTag : BaseTag
|
||||
//{
|
||||
// public ShortTag(string name, string enName, string unit, ComEnum.TagType tagType) : base(name, enName, unit, tagType)
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// private TestType _RtValue;
|
||||
// /// <summary>
|
||||
// /// 实时值
|
||||
// /// </summary>
|
||||
// public override TestType RtValue
|
||||
// {
|
||||
// get { return _RtValue; }
|
||||
// set { _RtValue = value; RaisePropertyChanged(); }
|
||||
// }
|
||||
|
||||
// //private OperateResult<short> _OperateResultSource;
|
||||
// ///// <summary>
|
||||
// ///// 原始值
|
||||
// ///// </summary>
|
||||
// //public override OperateResult<short> OperateResultSource
|
||||
// //{
|
||||
// // get { return _OperateResultSource; }
|
||||
// // set
|
||||
// // {
|
||||
// // if (value != _OperateResultSource)
|
||||
// // {
|
||||
// // RtValue = value.Content;
|
||||
// // }
|
||||
// // _OperateResultSource = value;
|
||||
// // }
|
||||
// //}
|
||||
|
||||
// private DataType _DataTypeInfo;
|
||||
// /// <summary>
|
||||
// /// 数据类型信息
|
||||
// /// </summary>
|
||||
// public override DataType DataTypeInfo
|
||||
// {
|
||||
// get { return _DataTypeInfo; }
|
||||
// set { _DataTypeInfo = value; RaisePropertyChanged(); }
|
||||
// }
|
||||
|
||||
//}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
using HslCommunication;
|
||||
using Prism.Mvvm;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
@@ -15,15 +14,38 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// <param name="name"></param>
|
||||
/// <param name="enName"></param>
|
||||
/// <param name="tagType"></param>
|
||||
public Tag(string name, string enName, string unit, TagType tagType, IRegisterValue<T> registerValue)
|
||||
public Tag(string nameNoUnit, string name, string enName, string group, string PVaddress, double maxValue, double minValue, short precision, string unit, ITagValue<T> tagValue, bool isMeter)
|
||||
{
|
||||
TagTypeInfo = tagType;
|
||||
Group = group;
|
||||
Name = name;
|
||||
Unit = unit;
|
||||
EnName = enName;
|
||||
PVAddress = PVaddress;
|
||||
MaxValue = maxValue;
|
||||
MinValue = minValue;
|
||||
Precision = precision;
|
||||
|
||||
IsMeter = isMeter;
|
||||
|
||||
NameNoUnit = nameNoUnit;
|
||||
|
||||
//实例化
|
||||
RtValue = registerValue;
|
||||
TagValue = tagValue;
|
||||
ValueType = typeof(T);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="enName"></param>
|
||||
/// <param name="tagType"></param>
|
||||
public Tag(ITagValue<T> tagValue)
|
||||
{
|
||||
//实例化
|
||||
TagValue = tagValue;
|
||||
ValueType = typeof(T);
|
||||
|
||||
}
|
||||
|
||||
@@ -37,19 +59,29 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// </summary>
|
||||
public string EnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称 无单位中文名称
|
||||
/// </summary>
|
||||
public string NameNoUnit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签组
|
||||
/// </summary>
|
||||
public string Group { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 实时值
|
||||
///// </summary>
|
||||
//public abstract IRegisterValue<short> RtValue { get; set; }
|
||||
|
||||
private IRegisterValue<T> _RtValue;
|
||||
private ITagValue<T> _TagValue;
|
||||
/// <summary>
|
||||
/// 寄存器
|
||||
/// 实时值
|
||||
/// </summary>
|
||||
public IRegisterValue<T> RtValue
|
||||
public ITagValue<T> TagValue
|
||||
{
|
||||
get { return _RtValue; }
|
||||
set { _RtValue = value; RaisePropertyChanged(); }
|
||||
get { return _TagValue; }
|
||||
set { _TagValue = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -57,20 +89,25 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// </summary>
|
||||
public OperateResult<T> OperateResultSource { get; set; } //
|
||||
|
||||
/// <summary>
|
||||
/// 标签类型信息
|
||||
/// </summary>
|
||||
public TagType TagTypeInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型信息
|
||||
/// </summary>
|
||||
public DataType DataTypeInfo { get; set; }
|
||||
public Type ValueType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址信息
|
||||
/// 地址信息 PV
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
public string PVAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址信息 SV
|
||||
/// </summary>
|
||||
public string SVAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址信息 MV
|
||||
/// </summary>
|
||||
public string MVAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址信息 Index
|
||||
@@ -88,11 +125,15 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
public double MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 精度
|
||||
/// 小数点
|
||||
/// 精度 到PLC的转换精度/分辨率
|
||||
/// </summary>
|
||||
public short Precision { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 小数点 展示时用的小数点
|
||||
/// </summary>
|
||||
public short DecimalPoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
@@ -101,14 +142,59 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// <summary>
|
||||
/// 采样周期
|
||||
/// </summary>
|
||||
public int SamplingPeriod { get; set; }
|
||||
}
|
||||
public int Samp { get; set; }
|
||||
|
||||
public struct TestType
|
||||
{
|
||||
public short shortValue { get; set; }
|
||||
public byte byteValue { get; set; }
|
||||
public double doubleValue { get; set; }
|
||||
/// <summary>
|
||||
/// 是否为仪表参数
|
||||
/// </summary>
|
||||
public bool IsMeter { get; set; }
|
||||
|
||||
private double _EngValue;
|
||||
/// <summary>
|
||||
/// 工程值
|
||||
/// </summary>
|
||||
public double EngValue
|
||||
{
|
||||
get { return _EngValue; }
|
||||
set
|
||||
{
|
||||
_EngValue = value;
|
||||
if (TagValue.IsShow)
|
||||
{
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
EngValueStr = Math.Round(value, DecimalPoint).ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private string _EngValueStr;
|
||||
/// <summary>
|
||||
/// 工程值的字符串
|
||||
/// </summary>
|
||||
public string EngValueStr
|
||||
{
|
||||
get { return _EngValueStr; }
|
||||
set { _EngValueStr = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
private double _MVValue = 20;
|
||||
/// <summary>
|
||||
/// MV值
|
||||
/// 不是所有的数据都有MV值,只有仪表参数设置的有
|
||||
/// </summary>
|
||||
public double MVValue
|
||||
{
|
||||
get { return _MVValue; }
|
||||
set
|
||||
{
|
||||
_MVValue = value;
|
||||
if (TagValue.IsShow)
|
||||
{
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,32 +11,32 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// </summary>
|
||||
public class TagHelper
|
||||
{
|
||||
private void ParseData(List<TagInfo> tagInfos)
|
||||
private void ParseData(List<ITag> tagInfos)
|
||||
{
|
||||
//分组数据
|
||||
var GroupData = tagInfos.GroupBy(x => x.DataTypeInfo).ToList();
|
||||
foreach (var group in GroupData)
|
||||
{
|
||||
var key = group.Key;
|
||||
var TagListData = group.ToList();
|
||||
switch (group.Key)
|
||||
{
|
||||
case ComEnum.DataType.Short:
|
||||
////分组数据
|
||||
//var GroupData = tagInfos.GroupBy(x => x.DataTypeInfo).ToList();
|
||||
//foreach (var group in GroupData)
|
||||
//{
|
||||
// var key = group.Key;
|
||||
// var TagListData = group.ToList();
|
||||
// switch (group.Key)
|
||||
// {
|
||||
// case ComEnum.DataType.Short:
|
||||
|
||||
break;
|
||||
case ComEnum.DataType.Double:
|
||||
// break;
|
||||
// case ComEnum.DataType.Double:
|
||||
|
||||
break;
|
||||
case ComEnum.DataType.String:
|
||||
// break;
|
||||
// case ComEnum.DataType.String:
|
||||
|
||||
break;
|
||||
case ComEnum.DataType.Byte:
|
||||
// break;
|
||||
// case ComEnum.DataType.Byte:
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// 标签的信息
|
||||
/// </summary>
|
||||
public abstract class TagInfo : BindableBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 实例化函数
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="enName"></param>
|
||||
/// <param name="tagType"></param>
|
||||
public TagInfo(string name,string enName, string unit,TagType tagType)
|
||||
{
|
||||
TagTypeInfo = tagType;
|
||||
Name = name;
|
||||
Unit = unit;
|
||||
EnName = enName;
|
||||
|
||||
//ListRtDataModel=new List<RtDataModel>();
|
||||
}
|
||||
|
||||
|
||||
//public List<RtDataModel> ListRtDataModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称 中文
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称 英文
|
||||
/// </summary>
|
||||
public string EnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签类型信息
|
||||
/// </summary>
|
||||
public TagType TagTypeInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据类型信息
|
||||
/// </summary>
|
||||
public DataType DataTypeInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址信息
|
||||
/// </summary>
|
||||
public string Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址信息 Index
|
||||
/// </summary>
|
||||
public string Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大值
|
||||
/// </summary>
|
||||
public double MaxValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小值
|
||||
/// </summary>
|
||||
public double MinValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 精度
|
||||
/// 小数点
|
||||
/// </summary>
|
||||
public short Precision { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string? Unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 采样周期
|
||||
/// </summary>
|
||||
public int SamplingPeriod { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,4 @@
|
||||
using NPOI.SS.Formula.PTG;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// 标签管理中心
|
||||
@@ -25,7 +17,7 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// <summary>
|
||||
/// 标签集合数据
|
||||
/// </summary>
|
||||
public Dictionary<string, ITag> DicTags = new Dictionary<string, ITag>();
|
||||
public Dictionary<string, ITag> DicTags { get; set; } = new Dictionary<string, ITag>();
|
||||
|
||||
/// <summary>
|
||||
/// 增加标签
|
||||
@@ -67,11 +59,29 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
// 如果找到标签,则返回其值,否则返回默认值
|
||||
if (FindTag != null)
|
||||
{
|
||||
return FindTag!.RtValue.Value;
|
||||
return FindTag!.TagValue.Value;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取标签的值信息
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public ITagValue<T>? GetTagInfoValueByName<T>(string name)
|
||||
{
|
||||
var FindTag = GetTagByName<T>(name);
|
||||
|
||||
// 如果找到标签,则返回其值,否则返回默认值
|
||||
if (FindTag != null)
|
||||
{
|
||||
return FindTag!.TagValue;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,21 +11,22 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// <summary>
|
||||
/// Short类型的寄存器数据
|
||||
/// </summary>
|
||||
public class ShortRegisterValue :BindableBase, IRegisterValue<short>
|
||||
public class ByteTagValue : BindableBase, ITagValue<byte>
|
||||
{
|
||||
private short _Value;
|
||||
private byte _Value;
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public short Value
|
||||
public byte Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set { _Value = value;RaisePropertyChanged(); }
|
||||
set { _Value = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 寄存器原始数据
|
||||
/// </summary>
|
||||
public OperateResult<short>? OperateResultSource { get; set; }
|
||||
/// <summary>
|
||||
/// 寄存器原始数据
|
||||
/// </summary>
|
||||
public OperateResult<byte>? OperateResultSource { get; set; }
|
||||
public bool IsShow { get; set; }
|
||||
}
|
||||
}
|
||||
31
CapMachine.Wpf/Models/Tag/TagValue/DoubleTagValue.cs
Normal file
31
CapMachine.Wpf/Models/Tag/TagValue/DoubleTagValue.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using HslCommunication;
|
||||
using Prism.Mvvm;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// Short类型的寄存器数据
|
||||
/// </summary>
|
||||
public class DoubleTagValue : BindableBase, ITagValue<double>
|
||||
{
|
||||
private double _Value;
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public double Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set { _Value = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否更新展示
|
||||
/// </summary>
|
||||
public bool IsShow { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 寄存器原始数据
|
||||
/// </summary>
|
||||
public OperateResult<double>? OperateResultSource { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// 寄存器类型
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public interface IRegisterValue<T> : INotifyPropertyChanged
|
||||
public interface ITagValue<T> : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary>
|
||||
/// 值
|
||||
@@ -18,5 +18,10 @@ namespace CapMachine.Wpf.Models.Tag
|
||||
/// 值原始数据
|
||||
/// </summary>
|
||||
OperateResult<T> OperateResultSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否展示
|
||||
/// </summary>
|
||||
bool IsShow { get; set; }
|
||||
}
|
||||
}
|
||||
66
CapMachine.Wpf/Models/Tag/TagValue/ShortTagValue.cs
Normal file
66
CapMachine.Wpf/Models/Tag/TagValue/ShortTagValue.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using HslCommunication;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// Short类型的寄存器数据
|
||||
/// </summary>
|
||||
public class ShortTagValue : BindableBase, ITagValue<short>
|
||||
{
|
||||
private short _Value;
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public short Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set
|
||||
{
|
||||
if (Value != value)
|
||||
{
|
||||
_Value = value;
|
||||
if (IsShow)
|
||||
{
|
||||
RaisePropertyChanged();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private OperateResult<short>? _OperateResultSource = new OperateResult<short>();
|
||||
/// <summary>
|
||||
/// 寄存器原始数据
|
||||
/// </summary>
|
||||
public OperateResult<short>? OperateResultSource
|
||||
{
|
||||
get { return _OperateResultSource; }
|
||||
set
|
||||
{
|
||||
if (value != _OperateResultSource)
|
||||
{
|
||||
Value = value.Content;
|
||||
_OperateResultSource = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否更新展示
|
||||
/// </summary>
|
||||
public bool IsShow { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 寄存器原始数据
|
||||
///// </summary>
|
||||
//public OperateResult<short>? OperateResultSource { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
32
CapMachine.Wpf/Models/Tag/TagValue/StringTagValue.cs
Normal file
32
CapMachine.Wpf/Models/Tag/TagValue/StringTagValue.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using HslCommunication;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// String类型的寄存器数据
|
||||
/// </summary>
|
||||
public class StringTagValue : BindableBase, ITagValue<string>
|
||||
{
|
||||
private string? _Value;
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public string? Value
|
||||
{
|
||||
get { return _Value; }
|
||||
set { _Value = value; RaisePropertyChanged(); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 寄存器原始数据
|
||||
/// </summary>
|
||||
public OperateResult<string>? OperateResultSource { get; set; }
|
||||
public bool IsShow { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static CapMachine.Wpf.Models.ComEnum;
|
||||
|
||||
namespace CapMachine.Wpf.Models.Tag
|
||||
{
|
||||
///// <summary>
|
||||
///// 一般的处理方法
|
||||
///// </summary>
|
||||
///// <typeparam name="T"></typeparam>
|
||||
//public class VarTag<T> : BaseTag
|
||||
//{
|
||||
// public VarTag(string name, string enName, string unit, ComEnum.TagType tagType) : base(name, enName, unit, tagType)
|
||||
// {
|
||||
|
||||
// }
|
||||
|
||||
// private object _RtValue;
|
||||
// /// <summary>
|
||||
// /// 实时值
|
||||
// /// </summary>
|
||||
// public override object RtValue
|
||||
// {
|
||||
// get { return _RtValue; }
|
||||
// set { _RtValue = (T)Convert.ChangeType(value, typeof(T)); RaisePropertyChanged(); }
|
||||
// }
|
||||
|
||||
|
||||
// private DataType _DataTypeInfo;
|
||||
// /// <summary>
|
||||
// /// 数据类型信息
|
||||
// /// </summary>
|
||||
// public override DataType DataTypeInfo
|
||||
// {
|
||||
// get { return _DataTypeInfo; }
|
||||
// set { _DataTypeInfo = value; RaisePropertyChanged(); }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
Reference in New Issue
Block a user