设置界面优化
This commit is contained in:
@@ -8,7 +8,26 @@ namespace UIShare.GlobalVariable
|
||||
public static class ConfigService
|
||||
{
|
||||
private static readonly object _fileLock = new();
|
||||
/// <summary>
|
||||
/// 根据标题查询配置文件是否存在
|
||||
/// </summary>
|
||||
public static bool IsExit(string title)
|
||||
{
|
||||
if (string.IsNullOrEmpty(title))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// 临时实例化一个对象以获取默认的 SystemPath
|
||||
var dummy = new SystemConfig();
|
||||
string configPath = Path.Combine(dummy.SystemPath, $"{title}.json");
|
||||
|
||||
if (!File.Exists(configPath))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据标题(格子标识)加载独立的配置文件
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using DeviceCommand.Base;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -27,6 +28,8 @@ namespace UIShare.GlobalVariable
|
||||
public PackIconKind RunIcon { get; set; } = PackIconKind.Play;
|
||||
public StepModel SelectedStep { get; set; }
|
||||
public ParameterModel SelectedParameter { get; set; }
|
||||
|
||||
public List<IBaseInterface> DeviceList { get; set; } = new();
|
||||
// 【新增测试属性】:每个实例被 new 出来时独一无二的随机身份
|
||||
// 证 ID
|
||||
public int DebugRandomId { get; private set; }
|
||||
|
||||
@@ -26,14 +26,68 @@ namespace UIShare.GlobalVariable
|
||||
public string DefaultProgramFilePath { get; set; } = "";
|
||||
public string DefaultBLFFilePath { get; set; } = "";
|
||||
public string DefaultDBCFilePath { get; set; } = "";
|
||||
public ObservableCollection<DeviceInfoModel> DeviceList = new();
|
||||
// public ObservableCollection<DeviceInfoModel> DeviceList { get; set; } = new()
|
||||
//{
|
||||
// new DeviceInfoModel
|
||||
// {
|
||||
// DeviceName = "IT7800E",
|
||||
// DeviceType = "IT7800E",
|
||||
// Remark = "交流可编程电源供应器",
|
||||
// ConnectionType = "Tcp",
|
||||
// IsEnabled = true,
|
||||
// IsConnected = false
|
||||
// },
|
||||
|
||||
public ObservableCollection<DeviceInfoModel> DeviceList { get; set; } = new()
|
||||
{
|
||||
new DeviceInfoModel { DeviceName = "DAQ_001", DeviceType = "数据采集卡", Remark = "8 通道电压采集", IsEnabled = true, IsConnected = false },
|
||||
new DeviceInfoModel { DeviceName = "PSU_002", DeviceType = "可编程电源", Remark = "0-30V / 0-5A", IsEnabled = true, IsConnected = false },
|
||||
new DeviceInfoModel { DeviceName = "CAN_003", DeviceType = "CAN 通讯卡", Remark = "双通道 CAN-FD", IsEnabled = false, IsConnected = false },
|
||||
new DeviceInfoModel { DeviceName = "IO_004", DeviceType = "数字 I/O", Remark = "16 进 16 出", IsEnabled = true, IsConnected = false },
|
||||
new DeviceInfoModel { DeviceName = "Serial_005", DeviceType = "串口", Remark = "RS232 / RS485", IsEnabled = true, IsConnected = false },
|
||||
};
|
||||
// new DeviceInfoModel
|
||||
// {
|
||||
// DeviceName = "N36200",
|
||||
// DeviceType = "N36200",
|
||||
// Remark = "宽范围可编程直流电源",
|
||||
// ConnectionType = "Tcp",
|
||||
// IsEnabled = true,
|
||||
// IsConnected = false
|
||||
// },
|
||||
|
||||
// new DeviceInfoModel
|
||||
// {
|
||||
// DeviceName = "N36600",
|
||||
// DeviceType = "N36600",
|
||||
// Remark = "便携式宽范围可编程直流电源",
|
||||
// ConnectionType = "Tcp",
|
||||
// IsEnabled = false,
|
||||
// IsConnected = false
|
||||
// },
|
||||
|
||||
// new DeviceInfoModel
|
||||
// {
|
||||
// DeviceName = "N69200",
|
||||
// DeviceType = "N69200",
|
||||
// Remark = "可编程直流电子负载",
|
||||
// ConnectionType = "Tcp",
|
||||
// IsEnabled = true,
|
||||
// IsConnected = false
|
||||
// },
|
||||
|
||||
// new DeviceInfoModel
|
||||
// {
|
||||
// DeviceName = "SDS2000X_HD",
|
||||
// DeviceType = "SDS2000X_HD",
|
||||
// Remark = "数字存储示波器",
|
||||
// ConnectionType = "Tcp",
|
||||
// IsEnabled = true,
|
||||
// IsConnected = false
|
||||
// },
|
||||
|
||||
// new DeviceInfoModel
|
||||
// {
|
||||
// DeviceName = "SPAW7000",
|
||||
// DeviceType = "SPAW7000",
|
||||
// Remark = "功率分析记录仪",
|
||||
// ConnectionType = "Tcp",
|
||||
// IsEnabled = true,
|
||||
// IsConnected = false
|
||||
// }
|
||||
//};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Common\Common.csproj" />
|
||||
<ProjectReference Include="..\DeviceCommand\DeviceCommand.csproj" />
|
||||
<ProjectReference Include="..\Logger\Logger.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace UIShare.ViewModelBase
|
||||
public IEventAggregator _eventAggregator;
|
||||
public IDialogService _dialogService;
|
||||
public IRegionManager _regionManager;
|
||||
public IModuleManager _moduleManager;
|
||||
private INotificationManager _notificationManager;
|
||||
private GlobalInfo _globalInfo;
|
||||
public NavigateViewModelBase(IContainerProvider containerProvider)
|
||||
@@ -21,6 +22,7 @@ namespace UIShare.ViewModelBase
|
||||
_globalInfo=containerProvider.Resolve<GlobalInfo>();
|
||||
_eventAggregator = containerProvider.Resolve<IEventAggregator>();
|
||||
_dialogService = containerProvider.Resolve<IDialogService>();
|
||||
_moduleManager = containerProvider.Resolve<IModuleManager>();
|
||||
_regionManager = containerProvider.Resolve<IRegionManager>();
|
||||
_notificationManager = containerProvider.Resolve<INotificationManager>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user