Files
CapMachine/CapMachine.Wpf/Services/ConfigService.cs

118 lines
3.0 KiB
C#

using CapMachine.Model;
using CapMachine.Wpf.Dtos;
using CapMachine.Wpf.PrismEvent;
using Prism.Events;
using Prism.Mvvm;
using Prism.Services.Dialogs;
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;
private HistoryExp _CurExpInfo;
/// <summary>
/// 当前的试验信息
/// </summary>
public HistoryExp CurExpInfo
{
get { return _CurExpInfo; }
set
{
_CurExpInfo = value;
if (value != null)
{
IsExpInfoOk = true;
}
RaisePropertyChanged();
}
}
/// <summary>
/// 试验信息是否OK
/// </summary>
public bool IsExpInfoOk { get; set; }
///// <summary>
///// 当前的试验信息
///// </summary>
//public HistoryExp CurExpInfo { get; set; }
private UserDto _CurUserDto;
/// <summary>
/// 当前的用户信息
/// </summary>
public UserDto CurUserDto
{
get { return _CurUserDto; }
set { _CurUserDto = value; RaisePropertyChanged(); }
}
public IEventAggregator EventAggregator { get; }
public PPCService PPCService { get; }
public IDialogService DialogService { get; }
}
}