165 lines
4.3 KiB
C#
165 lines
4.3 KiB
C#
using MainShell.Hardware;
|
|
using MainShell.Log;
|
|
using MainShell.Models;
|
|
using MwFramework.Device;
|
|
using MwFramework.Device.DeviceInterface;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MainShell.DeviceMaintance.ViewModel
|
|
{
|
|
public class HardwareTestViewModel:BaseScreen
|
|
{
|
|
private readonly HardwareManager _device;
|
|
private IFFUItem _ffuItem1;
|
|
|
|
private string _message = "XXXX";
|
|
public string Message
|
|
{
|
|
get
|
|
{
|
|
return _message;
|
|
}
|
|
set { SetAndNotify(ref _message, value); }
|
|
}
|
|
|
|
private string _waferBarcode = string.Empty;
|
|
/// <summary>
|
|
/// 方片扫码枪读取结果
|
|
/// </summary>
|
|
public string WaferBarcode
|
|
{
|
|
get { return _waferBarcode; }
|
|
set { SetAndNotify(ref _waferBarcode, value); }
|
|
}
|
|
|
|
private string _glassBarcode = string.Empty;
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 基板扫码枪读取结果
|
|
/// </summary>
|
|
public string GlassBarcode
|
|
{
|
|
get { return _glassBarcode; }
|
|
set { SetAndNotify(ref _glassBarcode, value); }
|
|
}
|
|
|
|
private int _fFURotateSpeed ;
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 基板扫码枪读取结果
|
|
/// </summary>
|
|
public int FFURotateSpeed
|
|
{
|
|
get { return _fFURotateSpeed; }
|
|
set { SetAndNotify(ref _fFURotateSpeed, value); }
|
|
}
|
|
|
|
public HardwareTestViewModel(HardwareManager hardwareManager)
|
|
{
|
|
_device = hardwareManager;
|
|
_ffuItem1 = _device.FFU?.Count > 0 ? _device.FFU[0] : null;
|
|
}
|
|
|
|
public void btnZeroClick()
|
|
{
|
|
try
|
|
{
|
|
_device.Diastimeter.ZeroReset();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogSysError(ex, true);
|
|
|
|
}
|
|
|
|
}
|
|
public void GetDarkReference()
|
|
{
|
|
IDeviceParamExtend p = _device.Diastimeter as IDeviceParamExtend;
|
|
if (p[(CommandStr)"GetDarkReference"].Execute())
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
}
|
|
public void btnGetCurrentValueClick()
|
|
{
|
|
try
|
|
{
|
|
_device.Diastimeter.GetLastSample(out double Distance);
|
|
Message = Convert.ToString(Distance);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogSysError(ex, true);
|
|
|
|
}
|
|
}
|
|
|
|
public void FFURotateSpeedChanged()
|
|
{
|
|
if (_ffuItem1 != null)
|
|
{
|
|
if (!_ffuItem1.CurrentOnOff) _ffuItem1.OnOff = true;
|
|
//_deviceDefaltSetting.Write();
|
|
_ffuItem1.SettingVelocity = FFURotateSpeed;
|
|
}
|
|
}
|
|
|
|
public void BtnOpenFFU()
|
|
{
|
|
if (_ffuItem1 != null)
|
|
{
|
|
if (!_ffuItem1.CurrentOnOff) _ffuItem1.OnOff = true;
|
|
}
|
|
}
|
|
|
|
public void BtnCloseFFU()
|
|
{
|
|
if (_ffuItem1 != null)
|
|
{
|
|
if (_ffuItem1.CurrentOnOff) _ffuItem1.OnOff = false;
|
|
}
|
|
}
|
|
|
|
public void btnScanWaferBarcodeClick()
|
|
{
|
|
try
|
|
{
|
|
//this.WaferBarcode = string.Empty;
|
|
//_device.WaferBarcodeScanner.TryScan(out string barcode, 1000);
|
|
//this.WaferBarcode = string.IsNullOrEmpty(barcode) ? "NA" : barcode;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogSysError(ex, true);
|
|
|
|
}
|
|
}
|
|
public async void btnScanGlassBarcodeClick()
|
|
{
|
|
try
|
|
{
|
|
await Task.Run(() =>
|
|
{
|
|
//this.GlassBarcode = string.Empty;
|
|
//_device.GlassBarcodeScanner.TryScan(out string barcode, 1000 * 5);
|
|
//this.GlassBarcode = string.IsNullOrEmpty(barcode) ? "NA" : barcode;
|
|
});
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogManager.LogSysError(ex, true);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|