diff --git a/SettingModule/ViewModels/SettingViewModel.cs b/SettingModule/ViewModels/SettingViewModel.cs
index 2b9aefe..08de9f9 100644
--- a/SettingModule/ViewModels/SettingViewModel.cs
+++ b/SettingModule/ViewModels/SettingViewModel.cs
@@ -7,46 +7,16 @@ using UIShare.UIViewModel;
using UIShare.ViewModelBase;
namespace SettingModule.ViewModels
{
- ///
- /// 设置界面 VM —— 复用与 RecordView/MonitorView 相同的范式:
- /// - ScopedContext 隔离(每工位独立一份)
- /// - 双击展开(ExpandViewEvent + GlobalInfo.CurrentScope)
- /// - OnNavigatedTo 取 Name 参数作为工位标题
- /// 设备数据来源:注入的 SystemConfig.DeviceList(Scoped 注入,每工位一份)。
- ///
public class SettingViewModel : NavigateViewModelBase, IRegionMemberLifetime, IDisposable
{
- #region 私有字段
- private readonly IScopedProvider _scope;
- private readonly SystemConfig _systemConfig;
- #endregion
-
- #region 系统参数(暴露给 XAML 绑定)
- ///
- /// 公开 SystemConfig 实例供 XAML 绑定(Tab 2"系统参数"页用)。
- /// 这是 Scoped 实例,每个工位一份,互不影响。
- ///
- 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 设备列表 / 选中设备
- /// 左侧设备列表,直接绑定 SystemConfig.DeviceList
- public ObservableCollection DeviceList { get; }
-
private DeviceInfoModel? _selectedDevice;
public DeviceInfoModel? SelectedDevice
{
@@ -59,25 +29,35 @@ namespace SettingModule.ViewModels
}
}
}
+ private ObservableCollection _deviceList;
+ public ObservableCollection 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; }
- /// 打开当前选中设备的连接配置对话框(按 ConnectionType 选择 TCP / 串口)。
public ICommand OpenConnectionConfigCommand { get; }
#endregion
- /// 支持的连接方式列表,供"连接方式"ComboBox 使用。
public ObservableCollection ConnectionTypes { get; } = new()
{
"None", "TCP", "Serial"