|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
using GalaSoft.MvvmLight.Command;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using SlnMesnac.Business;
|
|
|
|
|
using SlnMesnac.WPF.Page;
|
|
|
|
|
using SlnMesnac.WPF.Page.History;
|
|
|
|
|
using System;
|
|
|
|
@ -12,38 +13,30 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
public class MainWindowViewModel: ViewModelBase
|
|
|
|
|
{
|
|
|
|
|
private readonly ILogger<MainWindowViewModel> _logger;
|
|
|
|
|
private readonly TagScanBusiness tagScanBusiness;
|
|
|
|
|
|
|
|
|
|
private IndexControl indexControl = new IndexControl();
|
|
|
|
|
private HistoryControl historyControl = new HistoryControl();
|
|
|
|
|
|
|
|
|
|
#region 参数定义
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// PLC设备状态
|
|
|
|
|
/// RFID状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
private int _PlcStatus = 0;
|
|
|
|
|
public int PlcStatus
|
|
|
|
|
private int _RfidStatus = 0;
|
|
|
|
|
public int RfidStatus
|
|
|
|
|
{
|
|
|
|
|
get { return _PlcStatus; }
|
|
|
|
|
set { _PlcStatus = value; RaisePropertyChanged(nameof(PlcStatus)); }
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 箱壳扫码器状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
private int _ShellScannerStatus = 0;
|
|
|
|
|
public int ShellScannerStatus
|
|
|
|
|
{
|
|
|
|
|
get { return _ShellScannerStatus; }
|
|
|
|
|
set { _ShellScannerStatus = value; RaisePropertyChanged(nameof(ShellScannerStatus)); }
|
|
|
|
|
get { return _RfidStatus; }
|
|
|
|
|
set { _RfidStatus = value; RaisePropertyChanged(nameof(RfidStatus)); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 内胆扫码器状态
|
|
|
|
|
/// 相机状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
private int _BoldScannerStatus = 0;
|
|
|
|
|
public int BoldScannerStatus
|
|
|
|
|
private int _CamStatus = 0;
|
|
|
|
|
public int CamStatus
|
|
|
|
|
{
|
|
|
|
|
get { return _BoldScannerStatus; }
|
|
|
|
|
set { _BoldScannerStatus = value; RaisePropertyChanged(nameof(BoldScannerStatus)); }
|
|
|
|
|
get { return _CamStatus; }
|
|
|
|
|
set { _CamStatus = value; RaisePropertyChanged(nameof(CamStatus)); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public System.Windows.Controls.UserControl _content;
|
|
|
|
@ -83,12 +76,34 @@ namespace SlnMesnac.WPF.ViewModel
|
|
|
|
|
var sp = App.ServiceProvider;
|
|
|
|
|
|
|
|
|
|
_logger = App.ServiceProvider.GetService<ILogger<MainWindowViewModel>>();
|
|
|
|
|
tagScanBusiness = App.ServiceProvider.GetService<TagScanBusiness>();
|
|
|
|
|
|
|
|
|
|
ControlOnClickCommand = new RelayCommand<object>(obj => ControlOnClick(obj));
|
|
|
|
|
FormControlCommand = new RelayCommand<object>(x => FormControl(x));
|
|
|
|
|
|
|
|
|
|
UserContent = indexControl;
|
|
|
|
|
|
|
|
|
|
tagScanBusiness.RefreshDeviceStatusEvent += (rfid, cam) =>
|
|
|
|
|
{
|
|
|
|
|
if (rfid)
|
|
|
|
|
{
|
|
|
|
|
RfidStatus = 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
RfidStatus = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cam)
|
|
|
|
|
{
|
|
|
|
|
CamStatus = 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CamStatus = 1;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|