using Aurora; using Aurora.Api; using Aurora.Api.Manager; using Aurora.View; using Hermes; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using System.Windows.Input; using System.Windows.Threading; namespace AuroraChiller { public class UCChillerViewModel : NotifyPropertyChangedBase { private object _SelectedViewModel; public object SelectedViewModel { get => _SelectedViewModel; set { _SelectedViewModel = value; OnPropertyChanged(); } } public UCChillerViewModel(IAuroraEnvironment aurora, string deviceId) { var chiller = aurora.DeviceManager[deviceId] as SmcChiller; if (chiller == null || chiller._Config == null) { return; } switch (chiller._Config.Type) { case eChillerType.HRL: SelectedViewModel = new UCSmcChiller_HRLDeviceViewModel(aurora, deviceId); break; case eChillerType.HECR: SelectedViewModel = new UCSmcChiller_HECRDeviceViewModel(aurora, deviceId); break; case eChillerType.HRS: SelectedViewModel = new UCSmcChiller_HRSDeviceViewModel(aurora, deviceId); break; } } public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }