共有变量添加

This commit is contained in:
hsc
2026-06-23 14:21:13 +08:00
parent 5b721d2557
commit cd3cbe7c35
11 changed files with 174 additions and 34 deletions

View File

@@ -44,6 +44,11 @@ namespace SettingModule.ViewModels
{
get => _deviceList;
set => SetProperty(ref _deviceList, value);
}
public ObservableCollection<SharedParameter> SharedParameterList
{
get => _sharedParameterList;
set => SetProperty(ref _sharedParameterList, value);
}
public string StatusMessage
@@ -72,6 +77,7 @@ namespace SettingModule.ViewModels
private string _testStatus = string.Empty;
private DeviceInfoVM? _selectedDevice;
private ObservableCollection<DeviceInfoVM> _deviceList;
private ObservableCollection<SharedParameter> _sharedParameterList;
private string _statusMessage = "请在左侧选择设备查看 / 编辑配置";
#endregion
public SettingViewModel(IContainerExtension container) : base(container)
@@ -199,6 +205,20 @@ namespace SettingModule.ViewModels
SelectedDevice = DeviceList[0];
}
DeviceList = SystemConfig.DeviceList;
SharedParameterList=SystemConfig.SharedParameterList;
if (SharedParameterList.Count == 0)
{
foreach (var device in SystemConfig.ParameterList)
{
var sharedParam = new SharedParameter
{
Id = device.ID.ToString(),
ParameterName = device.Name,
Value = device.Value is int intVal ? intVal : Convert.ToInt32(device.Value)
};
SharedParameterList.Add(sharedParam);
}
}
IsInitiated = true;
}
}