DeviceManagerViewModel.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using CommunityToolkit.Mvvm.ComponentModel;
  2. using CommunityToolkit.Mvvm.Input;
  3. using Device;
  4. using GlobalData;
  5. namespace DeviceManagement.ViewModels;
  6. public partial class DeviceManagerViewModel : ObservableObject
  7. {
  8. public DeviceManagerViewModel(DeviceCollection deviceCollection)
  9. {
  10. this.DeviceCollection = deviceCollection;
  11. FakeData();
  12. }
  13. void FakeData()
  14. {
  15. DeviceCollection.Devices ??= [];
  16. DeviceCollection.Devices[DeviceModel.JetKepler] = [];
  17. for (int i = 1; i <= 6; i++)
  18. {
  19. DeviceInfo device = new()
  20. {
  21. DeviceModel = DeviceModel.JetKepler,
  22. DeviceSubModel = KeplerSubModel.JetKepler_2200A,
  23. DeviceName = $"Device {i}",
  24. Position = $"position-{i}"
  25. };
  26. DeviceCollection.Devices[DeviceModel.JetKepler].Add(device);
  27. }
  28. DeviceCollection.Devices[DeviceModel.Proxima] = [];
  29. for (int i = 1; i <= 3; i++)
  30. {
  31. DeviceInfo device = new()
  32. {
  33. DeviceModel = DeviceModel.Proxima,
  34. DeviceSubModel = ProximaSubModel.ELK,
  35. DeviceName = $"Device {i}",
  36. Position = $"position-{i}"
  37. };
  38. DeviceCollection.Devices[DeviceModel.Proxima].Add(device);
  39. }
  40. }
  41. [ObservableProperty]
  42. private DeviceCollection _DeviceCollection;
  43. [RelayCommand]
  44. private void CheckDetail(DeviceInfo deviceInfo)
  45. {
  46. }
  47. [RelayCommand]
  48. private void Setting(DeviceInfo deviceInfo)
  49. {
  50. }
  51. }