12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using CommunityToolkit.Mvvm.ComponentModel;
- using CommunityToolkit.Mvvm.Input;
- using Device;
- using EEMSMain.Data;
- using GeneralData;
- using GlobalData;
- using UICommon.CommonContainer;
- namespace EEMSMain.ViewModels;
- public partial class MainWindowViewModel : ObservableObject
- {
- public MainWindowViewModel(ICommonContainer commonContainer, ContainerManager containerManager, DeviceCollection deviceCollection)
- {
- this._commonContainer = commonContainer;
- this.ContainerManager = containerManager;
- this._deviceCollection = deviceCollection;
- this.FakeData();
- }
- private readonly ICommonContainer _commonContainer;
- public ContainerManager ContainerManager { get; }
- private readonly DeviceCollection _deviceCollection;
- void FakeData()
- {
- _deviceCollection.Devices ??= [];
- _deviceCollection.Devices[DeviceModel.JetKepler] = [];
- for (int i = 1; i <= 6; i++)
- {
- DeviceInfo device = new()
- {
- DeviceModel = DeviceModel.JetKepler,
- DeviceSubModel = KeplerSubModel.JetKepler_2200A,
- DeviceName = $"Device {i}",
- Position = $"position-{i}",
- SoftwareVersion = "1.0.0.0",
- Guid = Guid.NewGuid(),
- };
- _deviceCollection.Devices[DeviceModel.JetKepler].Add(device);
- }
- _deviceCollection.Devices[DeviceModel.Proxima] = [];
- for (int i = 1; i <= 3; i++)
- {
- DeviceInfo device = new()
- {
- DeviceModel = DeviceModel.Proxima,
- DeviceSubModel = ProximaSubModel.ELK,
- DeviceName = $"Device {i}",
- Position = $"position-{i}",
- SoftwareVersion = "1.0.0.0",
- Guid = Guid.NewGuid(),
- };
- _deviceCollection.Devices[DeviceModel.Proxima].Add(device);
- }
- }
- [ObservableProperty]
- private string? _CurrentModule;
- [RelayCommand]
- private void Open(ContainerInfo para)
- {
- try
- {
- _commonContainer.RequestNavigation(para.ModuleName);
- this.CurrentModule = para.Name;
- }
- catch
- {
- }
- }
- }
|