117 lines
3.6 KiB
C#
117 lines
3.6 KiB
C#
using Aurora;
|
|
using Aurora.View;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Input;
|
|
using System.Windows.Threading;
|
|
|
|
namespace AuroraOCT.Trumpf.Views
|
|
{
|
|
public class UCTrumpfOCTViewModel : NotifyPropertyChangedBase
|
|
{
|
|
private IAuroraEnvironment _env;
|
|
private OCT _dev;
|
|
|
|
public bool PreTrigger {
|
|
get => _PreTrigger;
|
|
set {
|
|
SetProperty(ref _PreTrigger, value);
|
|
_dev.SetPreTrigger(_PreTrigger);
|
|
}
|
|
}
|
|
private bool _PreTrigger;
|
|
public bool InTrigger {
|
|
get => _InTrigger;
|
|
set {
|
|
SetProperty(ref _InTrigger, value);
|
|
_dev.SetInTrigger(_InTrigger);
|
|
}
|
|
}
|
|
private bool _InTrigger;
|
|
|
|
public bool PosGen {
|
|
get => _PosGen;
|
|
set {
|
|
SetProperty(ref _PosGen, value);
|
|
_dev.SetPosGen(_PosGen);
|
|
}
|
|
}
|
|
private bool _PosGen;
|
|
public int LightPath {
|
|
get => _LightPath;
|
|
set {
|
|
SetProperty(ref _LightPath, value);
|
|
_dev.SetLightPath(_LightPath);
|
|
}
|
|
}
|
|
private int _LightPath;
|
|
public int PositionX {
|
|
get => _PositionX;
|
|
set {
|
|
SetProperty(ref _PositionX, value);
|
|
_dev.SetPositionX(_PositionX);
|
|
}
|
|
}
|
|
private int _PositionX;
|
|
public int PositionY {
|
|
get => _PositionY;
|
|
set {
|
|
SetProperty(ref _PositionY, value);
|
|
_dev.SetPositionY(_PositionY);
|
|
}
|
|
}
|
|
private int _PositionY;
|
|
public bool IsPreTrigger { get => _IsPreTrigger; set => SetProperty(ref _IsPreTrigger, value); }
|
|
private bool _IsPreTrigger;
|
|
public bool IsInTrigger { get => _IsInTrigger; set => SetProperty(ref _IsInTrigger, value); }
|
|
private bool _IsInTrigger;
|
|
public bool IsPosGen { get => _IsPosGen; set => SetProperty(ref _IsPosGen, value); }
|
|
private bool _IsPosGen;
|
|
public double getPositionX { get => _getPositionX; set => SetProperty(ref _getPositionX, value); }
|
|
private double _getPositionX;
|
|
public double getPositionY { get => _getPositionY; set => SetProperty(ref _getPositionY, value); }
|
|
private double _getPositionY;
|
|
|
|
public int LightPathFromLaser { get => _LightPathFromLaser; set => SetProperty(ref _LightPathFromLaser, value); }
|
|
private int _LightPathFromLaser;
|
|
|
|
public ICommand CMD_VisibleChanged { get; }
|
|
private DispatcherTimer _timer;
|
|
public UCTrumpfOCTViewModel(IAuroraEnvironment auroraEnv, string deviceId)
|
|
{
|
|
_env = auroraEnv;
|
|
_dev = auroraEnv.DeviceManager[deviceId] as OCT;
|
|
|
|
CMD_VisibleChanged = new DelegateCommand(VisibleChanged);
|
|
_timer = new DispatcherTimer();
|
|
_timer.Tick += Update;
|
|
_timer.Interval = TimeSpan.FromMilliseconds(100);
|
|
}
|
|
|
|
private void VisibleChanged(object obj)
|
|
{
|
|
bool visible = (bool)obj;
|
|
if (visible) {
|
|
_timer.Start();
|
|
|
|
} else {
|
|
_timer.Stop();
|
|
}
|
|
}
|
|
|
|
private void Update(object sender, EventArgs e)
|
|
{
|
|
IsPreTrigger = _dev.IsPreTrigger();
|
|
IsInTrigger = _dev.IsInTrigger();
|
|
IsPosGen = _dev.IsPosGen();
|
|
|
|
getPositionX = _dev.GetPositionX();
|
|
getPositionY = _dev.GetPositionY();
|
|
}
|
|
|
|
}
|
|
}
|