40 lines
938 B
C#
40 lines
938 B
C#
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using CommunityToolkit.Mvvm.Input;
|
|
using Cowain.Base.ViewModels;
|
|
using Ke.Bee.Localization.Localizer.Abstractions;
|
|
using Plugin.Cowain.Driver.Abstractions;
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace Plugin.Cowain.Driver.ViewModels;
|
|
|
|
public partial class VariableMonitorViewModel : PageViewModelBase
|
|
{
|
|
|
|
[ObservableProperty]
|
|
private ObservableCollection<DeviceViewModel>? _devices;
|
|
|
|
[ObservableProperty]
|
|
private DeviceViewModel? _selectedDevice;
|
|
|
|
|
|
private readonly IDeviceMonitor _deviceMonitor;
|
|
private readonly ILocalizer _l;
|
|
public VariableMonitorViewModel(ILocalizer localizer, IDeviceMonitor deviceMonitor)
|
|
{
|
|
_l = localizer;
|
|
_deviceMonitor = deviceMonitor;
|
|
}
|
|
|
|
[RelayCommand]
|
|
private void Loaded()
|
|
{
|
|
//获取所有设备
|
|
var devices = _deviceMonitor.Devices;
|
|
Devices = new(devices);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|