using Aurora; using Aurora.Api.Manager; using Aurora.View; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; using System.Windows.Data; using System.Windows.Input; using System.Windows.Media; namespace AuroraLaser { public class LaserColorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool isNormal = (bool)value; if (isNormal) { return Brushes.Red; } return Brushes.White; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } public class UCLaserTestViewModel : NotifyPropertyChangedBase { private IDeviceManager _DeviceManager; private readonly Laser _Laser; public ICommand CMD_LASER { get; } private bool _IsNormal; public bool IsNormal { get => _IsNormal; set => SetProperty(ref _IsNormal, value); } public UCLaserTestViewModel(IDeviceManager devManger, Laser laser) { CMD_LASER = new DelegateCommand(ONLASER); _DeviceManager = devManger; _Laser = laser; } private void ONLASER(object obj) { if (!_Laser.IsLaser) { _Laser.IsLaser = true; } else { _Laser.IsLaser = false; } if (_Laser.IsLaser) { IsNormal = true; } else { IsNormal = false; } } } }