重构CpuType
This commit is contained in:
@@ -113,25 +113,25 @@ public partial class DevicesViewModel : ViewModelBase, INavigatable
|
||||
PrimaryButContent = "添加设备"
|
||||
};
|
||||
// 1. 显示添加设备对话框
|
||||
// DeviceItemViewModel device = await _dialogService.ShowDialogAsync(deviceDialogViewModel);
|
||||
// // 如果用户取消或对话框未返回设备,则直接返回
|
||||
// if (device == null)
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
DeviceItemViewModel device = await _dialogService.ShowDialogAsync(deviceDialogViewModel);
|
||||
// 如果用户取消或对话框未返回设备,则直接返回
|
||||
if (device == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceItemViewModel device = new DeviceItemViewModel()
|
||||
{
|
||||
Name = "Test",
|
||||
Description = "Test Device",
|
||||
IpAddress = "127.0.0.1",
|
||||
Port = 8080,
|
||||
Protocol = ProtocolType.S7,
|
||||
CpuType = "S7-1200",
|
||||
DeviceType = DeviceType.SiemensPLC,
|
||||
IsActive = true,
|
||||
|
||||
};
|
||||
// DeviceItemViewModel device = new DeviceItemViewModel()
|
||||
// {
|
||||
// Name = "Test",
|
||||
// Description = "Test Device",
|
||||
// IpAddress = "127.0.0.1",
|
||||
// Port = 8080,
|
||||
// Protocol = ProtocolType.S7,
|
||||
// CpuType = "S7-1200",
|
||||
// DeviceType = DeviceType.SiemensPLC,
|
||||
// IsActive = true,
|
||||
//
|
||||
// };
|
||||
|
||||
|
||||
CreateDeviceWithDetailsDto dto = new CreateDeviceWithDetailsDto();
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// 文件: DMS.WPF/ViewModels/Items/DeviceItemViewModel.cs
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using DMS.Application.DTOs;
|
||||
using DMS.Core.Enums;
|
||||
@@ -35,7 +37,7 @@ public partial class DeviceItemViewModel : ObservableObject
|
||||
private int _slot;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _cpuType;
|
||||
private CpuType _cpuType;
|
||||
|
||||
[ObservableProperty]
|
||||
private DeviceType _deviceType;
|
||||
@@ -51,8 +53,8 @@ public partial class DeviceItemViewModel : ObservableObject
|
||||
|
||||
[ObservableProperty]
|
||||
private string _status;
|
||||
|
||||
public List<VariableTableItemViewModel> VariableTables { get; set; }
|
||||
|
||||
public ObservableCollection<VariableTableItemViewModel> VariableTables { get; set; } = new();
|
||||
|
||||
public DeviceItemViewModel(DeviceDto dto)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ public partial class VariableItemViewModel : ObservableObject
|
||||
private List<VariableMqttAliasDto>? _mqttAliases;
|
||||
|
||||
[ObservableProperty]
|
||||
private SignalType _signalType;
|
||||
private SignalType _signalType ;
|
||||
|
||||
[ObservableProperty]
|
||||
private PollLevelType _pollLevel;
|
||||
|
||||
@@ -46,6 +46,10 @@ public partial class SplashViewModel : ObservableObject
|
||||
await _dataServices.LoadVariableTables();
|
||||
await _dataServices.LoadVariables();
|
||||
await _dataServices.LoadMenus();
|
||||
|
||||
_dataServices.AssociateVariableTablesToDevices();
|
||||
_dataServices.AssociateVariablesToVariableTables();
|
||||
|
||||
// 可以在这里添加加载配置的逻辑
|
||||
await Task.Delay(500); // 模拟耗时
|
||||
|
||||
|
||||
Reference in New Issue
Block a user