后端问题处理

This commit is contained in:
czj
2026-06-05 13:34:13 +08:00
parent fdaa2490c4
commit 347f292e9b

View File

@@ -7,46 +7,16 @@ using UIShare.UIViewModel;
using UIShare.ViewModelBase;
namespace SettingModule.ViewModels
{
/// <summary>
/// 设置界面 VM —— 复用与 RecordView/MonitorView 相同的范式:
/// - ScopedContext 隔离(每工位独立一份)
/// - 双击展开ExpandViewEvent + GlobalInfo.CurrentScope
/// - OnNavigatedTo 取 Name 参数作为工位标题
/// 设备数据来源:注入的 SystemConfig.DeviceListScoped 注入,每工位一份)。
/// </summary>
public class SettingViewModel : NavigateViewModelBase, IRegionMemberLifetime, IDisposable
{
#region
private readonly IScopedProvider _scope;
private readonly SystemConfig _systemConfig;
#endregion
#region XAML
/// <summary>
/// 公开 SystemConfig 实例供 XAML 绑定Tab 2"系统参数"页用)。
/// 这是 Scoped 实例,每个工位一份,互不影响。
/// </summary>
public SystemConfig SystemConfig => _systemConfig;
#endregion
#region /
#region
public bool KeepAlive => true;
public ScopedContext _scopedContext { get; }
// 公开一份 GlobalInfo 供双击展开使用(基类 _globalInfo 是 private
public GlobalInfo GlobalInfoRef { get; }
private string _testStatus = string.Empty;
public string TestStatus
{
get => _testStatus;
set => SetProperty(ref _testStatus, value);
}
#endregion
#region /
/// <summary>左侧设备列表,直接绑定 SystemConfig.DeviceList</summary>
public ObservableCollection<DeviceInfoModel> DeviceList { get; }
private DeviceInfoModel? _selectedDevice;
public DeviceInfoModel? SelectedDevice
{
@@ -59,25 +29,35 @@ namespace SettingModule.ViewModels
}
}
}
private ObservableCollection<DeviceInfoModel> _deviceList;
public ObservableCollection<DeviceInfoModel> DeviceList
{
get { return _deviceList; }
set { SetProperty(ref _deviceList,value); }
}
private string _statusMessage = "请在左侧选择设备查看 / 编辑配置";
public string StatusMessage
{
get => _statusMessage;
set => SetProperty(ref _statusMessage, value);
}
#endregion
#region
private readonly IScopedProvider _scope;
private readonly SystemConfig _systemConfig;
private ScopedContext _scopedContext { get; }
private GlobalInfo GlobalInfoRef { get; }
#endregion
#region
// 双击展开 / 折叠九宫格(与 MonitorView/RecordView 共用同一套 ExpandViewEvent
public ICommand RefreshCommand { get; }
public ICommand SaveCommand { get; }
public ICommand ResetCommand { get; }
/// <summary>打开当前选中设备的连接配置对话框(按 ConnectionType 选择 TCP / 串口)。</summary>
public ICommand OpenConnectionConfigCommand { get; }
#endregion
/// <summary>支持的连接方式列表,供"连接方式"ComboBox 使用。</summary>
public ObservableCollection<string> ConnectionTypes { get; } = new()
{
"None", "TCP", "Serial"