实现了添加设备的功能,并写了Object对象的扩展CopyTo方法,实现了数据表的创建。

This commit is contained in:
2025-06-12 18:41:46 +08:00
parent ea15ea594a
commit 6ee5f10aed
11 changed files with 154 additions and 36 deletions

View File

@@ -1,13 +1,28 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using PMSWPF.Extensions;
using PMSWPF.Models;
namespace PMSWPF.ViewModels.Dialogs;
public partial class DeviceDialogViewModel:ObservableObject
{
private readonly Device _saveDevice;
[ObservableProperty]
private string title="添加设备";
public DeviceDialogViewModel()
[ObservableProperty]
private Device device;
public DeviceDialogViewModel(Device saveDevice)
{
_saveDevice = saveDevice;
this.device = new Device();
}
[RelayCommand]
public void AddDevice()
{
this.device.CopyTo<Device>(_saveDevice);
}
}