Files
test_demo/MX-PD-盘古 - new/PanGu.DieBonderApp/MainShell/ToolBox/ViewModel/UpCamLightViewModel.cs

58 lines
2.2 KiB
C#
Raw Normal View History

using MainShell.Hardware;
using MainShell.Models;
using Stylet;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MainShell.ToolBox.ViewModel
{
public class UpCamLightViewModel : PropertyChangedBase
{
private UpCamLightConfig _upCamLightConfig = new UpCamLightConfig();
public UpCamLightConfig UpCamLightConfig
{
get { return _upCamLightConfig; }
set { SetAndNotify(ref _upCamLightConfig, value); }
}
private readonly HardwareManager _hardwareManager;
public UpCamLightViewModel(HardwareManager hardwareManager)
{
this._hardwareManager = hardwareManager;
_upCamLightConfig.PropertyChanged -= UpCamLightConfig_PropertyChanged;
_upCamLightConfig.PropertyChanged += UpCamLightConfig_PropertyChanged;
}
private void UpCamLightConfig_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(UpCamLightConfig.RingBlueLight))
{
Debug.WriteLine("RingBlueLight changed to: " + UpCamLightConfig.RingBlueLight);
_hardwareManager.Up_RingBlueLight.SetIntensity(UpCamLightConfig.RingBlueLight);
}
else if (e.PropertyName == nameof(UpCamLightConfig.RingRedLight))
{
_hardwareManager.Up_RingRedLight.SetIntensity(UpCamLightConfig.RingRedLight);
}
else if (e.PropertyName == nameof(UpCamLightConfig.PointBlueLight))
{
_hardwareManager.Up_PointBlueLight.SetIntensity(UpCamLightConfig.PointBlueLight);
}
else if (e.PropertyName == nameof(UpCamLightConfig.PointRedLight))
{
_hardwareManager.Up_PointRedLight.SetIntensity(UpCamLightConfig.PointRedLight);
}
else if (e.PropertyName == nameof(UpCamLightConfig.RedBackLight))
{
_hardwareManager.Up_RedBackLight.SetIntensity(UpCamLightConfig.RedBackLight);
}
}
}
}