添加S7后台服务和添加PLC所需要的属性

This commit is contained in:
2025-07-05 01:31:44 +08:00
parent 69b75ef228
commit 404501cc17
8 changed files with 295 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using PMSWPF.Models;
using S7.Net; // Add this using directive
namespace PMSWPF.ViewModels.Dialogs;
@@ -8,6 +9,13 @@ public partial class DeviceDialogViewModel : ObservableObject
{
[ObservableProperty]
private Device _device;
partial void OnDeviceChanged(Device value)
{
if (value != null)
{
System.Diagnostics.Debug.WriteLine($"Device ProtocolType changed to: {value.ProtocolType}");
}
}
[ObservableProperty] private string title ;
[ObservableProperty] private string primaryButContent ;
@@ -17,6 +25,9 @@ public partial class DeviceDialogViewModel : ObservableObject
_device = device;
}
// Add a property to expose CpuType enum values for ComboBox
public Array CpuTypes => Enum.GetValues(typeof(CpuType));
[RelayCommand]
public void AddDevice()