167 lines
4.3 KiB
C#
167 lines
4.3 KiB
C#
using CapMachine.Model;
|
|
using CapMachine.Model.CANLIN;
|
|
using CapMachine.Wpf.Dtos;
|
|
using CapMachine.Wpf.Models;
|
|
using CapMachine.Wpf.PrismEvent;
|
|
using Prism.Events;
|
|
using Prism.Mvvm;
|
|
using Prism.Services.Dialogs;
|
|
using static CapMachine.Wpf.Models.ComEnum;
|
|
|
|
namespace CapMachine.Wpf.Services
|
|
{
|
|
/// <summary>
|
|
/// 配置服务中心
|
|
/// 状态中心
|
|
/// </summary>
|
|
public class ConfigService : BindableBase
|
|
{
|
|
public ConfigService(IEventAggregator eventAggregator, IDialogService dialogService)
|
|
{
|
|
CurUserDto = new UserDto();
|
|
|
|
EventAggregator = eventAggregator;
|
|
|
|
DialogService = dialogService;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Csv文件锁
|
|
/// 防止同时读取数据
|
|
/// </summary>
|
|
public static readonly object CsvFileLock = new object();
|
|
|
|
/// <summary>
|
|
/// 高速 消息数据的 Csv文件锁
|
|
/// 防止同时读取数据
|
|
/// </summary>
|
|
public static readonly object HighSpeedMsgCsvFileLock = new object();
|
|
|
|
/// <summary>
|
|
/// 高速数据文件缓存小时数
|
|
/// </summary>
|
|
public short HighSpeedMsgCsvFileCacheHour { get; set; } = 5;
|
|
|
|
/// <summary>
|
|
/// 记录周期
|
|
/// </summary>
|
|
public short RecordCycle { get; set; } = 1000;
|
|
|
|
/// <summary>
|
|
/// 是否开始记录数据
|
|
/// </summary>
|
|
public bool IsRecord { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// SCV保存的根路径
|
|
/// </summary>
|
|
public string SaveCsvRootPath { get; set; } = "D:\\TestData";
|
|
|
|
/// <summary>
|
|
/// 高速 消息数据的 SCV保存的根路径
|
|
/// </summary>
|
|
public string HighSpeedMsgSaveCsvRootPath { get; set; } = "D:\\TestData";
|
|
|
|
/// <summary>
|
|
/// 实时曲线数据缓存的时间(秒)
|
|
/// </summary>
|
|
public int ChartRtDataCacheTimeSec { get; set; } = 3600_8;
|
|
|
|
/// <summary>
|
|
/// 曲线保存临时状态
|
|
/// 曲线照片保存会执行两次,这个是屏蔽的状态
|
|
/// </summary>
|
|
public bool ChartSavePageTempState { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// CAN和LIN的运行状态模型
|
|
/// </summary>
|
|
public CanLinRunStateModel CanLinRunStateModel { get; set; } = new CanLinRunStateModel();
|
|
|
|
|
|
private int _PlcCycleTime;
|
|
/// <summary>
|
|
/// PLC循环时间
|
|
/// </summary>
|
|
public int PlcCycleTime
|
|
{
|
|
get { return _PlcCycleTime; }
|
|
set
|
|
{
|
|
if (value!= _PlcCycleTime)
|
|
{
|
|
_PlcCycleTime = value;
|
|
RaisePropertyChanged();
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private HistoryExp _CurExpInfo;
|
|
/// <summary>
|
|
/// 当前的试验信息
|
|
/// </summary>
|
|
public HistoryExp CurExpInfo
|
|
{
|
|
get { return _CurExpInfo; }
|
|
set
|
|
{
|
|
_CurExpInfo = value;
|
|
if (value != null)
|
|
{
|
|
IsExpInfoOk = true;
|
|
}
|
|
RaisePropertyChanged();
|
|
}
|
|
}
|
|
|
|
private bool _IsExpInfoOk;
|
|
/// <summary>
|
|
/// 试验信息是否OK
|
|
/// </summary>
|
|
public bool IsExpInfoOk
|
|
{
|
|
get { return _IsExpInfoOk; }
|
|
set { _IsExpInfoOk = value; RaisePropertyChanged(); }
|
|
}
|
|
|
|
///// <summary>
|
|
///// 当前的试验信息
|
|
///// </summary>
|
|
//public HistoryExp CurExpInfo { get; set; }
|
|
|
|
|
|
private UserDto _CurUserDto;
|
|
/// <summary>
|
|
/// 当前的用户信息
|
|
/// </summary>
|
|
public UserDto CurUserDto
|
|
{
|
|
get { return _CurUserDto; }
|
|
set { _CurUserDto = value; RaisePropertyChanged(); }
|
|
}
|
|
|
|
private bool _IsUserLoggedIn;
|
|
/// <summary>
|
|
/// 当前用户是否已登录
|
|
/// </summary>
|
|
public bool IsUserLoggedIn
|
|
{
|
|
get { return _IsUserLoggedIn; }
|
|
set { _IsUserLoggedIn = value; RaisePropertyChanged(); }
|
|
}
|
|
|
|
public IEventAggregator EventAggregator { get; }
|
|
public PPCService PPCService { get; }
|
|
public IDialogService DialogService { get; }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|