using MaxwellFramework.Core.Common; using MwFramework.Controls.ControlCanvas.Model; using MwFramework.ManagerService; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MainShell.Common.Display.Models { public class CameraAxisDevices : ViewModelBase { List _hardwareDeviceList = new List(); HardwareDevice _selectedHardwareDevice = new HardwareDevice(); private ObservableCollection _shapes = new ObservableCollection(); private int _selectedIndex = 0; private bool _cameraSwitchEnable = true; public List HardwareDeviceList { get { return _hardwareDeviceList; } set { if (_hardwareDeviceList == value) { return; } _hardwareDeviceList = value; if (_hardwareDeviceList != null && _hardwareDeviceList.Count > 0) { _selectedIndex = 0; SelectedHardwareDevice = _hardwareDeviceList[_selectedIndex]; RaisePropertyChanged(nameof(SelectedIndex)); } RaisePropertyChanged(nameof(HardwareDeviceList)); } } public HardwareDevice SelectedHardwareDevice { get { return _selectedHardwareDevice; } set { if (_selectedHardwareDevice != null && _selectedHardwareDevice.Camera != null && value != null && value.Camera != null) { } _selectedHardwareDevice = value; RaisePropertyChanged(nameof(SelectedHardwareDevice)); } } public ObservableCollection Shapes { get { return _shapes; } set { if (_shapes != value) { _shapes = value; RaisePropertyChanged(nameof(Shapes)); } } } private ObservableCollection _regions = new ObservableCollection(); public ObservableCollection Regions { get { return _regions; } set { SetAndNotify(ref _regions, value); } } public int SelectedIndex { get { return _selectedIndex; } set { _selectedIndex = value; if (HardwareDeviceList != null && HardwareDeviceList.Count > 0 && _selectedIndex >= 0) { if (_selectedIndex < HardwareDeviceList.Count) { SelectedHardwareDevice = HardwareDeviceList[_selectedIndex]; } } RaisePropertyChanged(nameof(SelectedIndex)); } } public bool CameraSwitchEnable { get { return _cameraSwitchEnable; } set { _cameraSwitchEnable = value; RaisePropertyChanged(nameof(CameraSwitchEnable)); } } } }