Files
CapMachine/CapMachine.Wpf/LinDrive/LinLdfModel.cs

118 lines
3.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CapMachine.Wpf.LinDrive
{
/// <summary>
/// LDF消息
/// </summary>
public class LinLdfModel : BindableBase
{
/// <summary>
/// 消息Id
/// </summary>
public string? MsgId { get; set; }
/// <summary>
/// 配置的中文名称:速度,转速限制,使能等常用的信息数据
/// 但不是所有的SignalName都会配置一个Name只是需要时才会配置名称
/// 但是CanDbcModel集合会包括所有的SignalName名称的
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 消息名称/Frame名称/帧名称
/// </summary>
public string? MsgName { get; set; }
/// <summary>
/// 信号名称
/// </summary>
public string? SignalName { get; set; }
/// <summary>
/// 信号描述
/// </summary>
public string? SignalDesc { get; set; }
/// <summary>
/// 信号单位
/// </summary>
public string? SignalUnit { get; set; }
private string? _SignalRtValue = "--";
/// <summary>
/// 信号实时值
/// </summary>
public string? SignalRtValue
{
get { return _SignalRtValue; }
set
{
if (_SignalRtValue != value)
{
_SignalRtValue = value;
RaisePropertyChanged();
}
}
}
private StringBuilder _SignalRtValueSb = new StringBuilder(16);
/// <summary>
/// 信号实时值 StringBuilder
/// </summary>
public StringBuilder SignalRtValueSb
{
get { return _SignalRtValueSb; }
set
{
if (value == null)
{
if (_SignalRtValue != string.Empty)
{
_SignalRtValueSb.Clear();
SignalRtValue = string.Empty;
}
return;
}
// 复制内容到内部可变缓冲区,避免多个模型共享同一个 StringBuilder 实例
var str = value.ToString();
if (!string.Equals(_SignalRtValue, str, StringComparison.Ordinal))
{
_SignalRtValueSb.Clear();
_SignalRtValueSb.Append(str);
SignalRtValue = str;
}
}
}
private int _IsSeletedInfo;
/// <summary>
/// 被选中的信息
/// 方便标注着色
/// </summary>
public int IsSeletedInfo
{
get { return _IsSeletedInfo; }
set { _IsSeletedInfo = value; RaisePropertyChanged(); }
}
/// <summary>
/// 发布者
/// </summary>
public string? Publisher { get; set; }
/// <summary>
/// 是否主机帧
/// </summary>
public string? IsMasterFrame { get; set; }
}
}