43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using MainShell.Hardware;
|
|
using MainShell.Models;
|
|
using Stylet;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MainShell.ToolBox.ViewModel
|
|
{
|
|
public class MapCamLightViewModel : PropertyChangedBase
|
|
{
|
|
private MapCamLightConfig _mapCamLightConfig = new MapCamLightConfig();
|
|
|
|
public MapCamLightConfig MapCamLightConfig
|
|
{
|
|
get { return _mapCamLightConfig; }
|
|
set { SetAndNotify(ref _mapCamLightConfig, value); }
|
|
}
|
|
private readonly HardwareManager _hardwareManager;
|
|
public MapCamLightViewModel(HardwareManager hardwareManager)
|
|
{
|
|
this._hardwareManager = hardwareManager;
|
|
_mapCamLightConfig.PropertyChanged -= MapCamLightConfig_PropertyChanged;
|
|
_mapCamLightConfig.PropertyChanged += MapCamLightConfig_PropertyChanged;
|
|
}
|
|
|
|
private void MapCamLightConfig_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
{
|
|
if(e.PropertyName==nameof(MapCamLightConfig.BlueLight))
|
|
{
|
|
_hardwareManager.Map_BlueLight.SetIntensity(MapCamLightConfig.BlueLight);
|
|
}
|
|
else if(e.PropertyName==nameof(MapCamLightConfig.RedLight))
|
|
{
|
|
_hardwareManager.Map_RedLight.SetIntensity(MapCamLightConfig.RedLight);
|
|
}
|
|
}
|
|
}
|
|
}
|