using Community;
using HalconDotNet;
using Model;
using Model.Vision;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace ViewModel.Vision
{
///
/// 扫码相关
///
partial class HalconVisual
{
///
/// 二维码扫码模式是否已初始化
///
public bool QRModelInitialize { get; set; }
///
/// 条形码扫码模式是否已初始化
///
public bool CodeModelInitialize { get; set; }
///
/// 创建扫码ROI
///
public DelegateCommand CreateSweepCodeROICommand { get; set; }
///
/// 扫码测试
///
public DelegateCommand SweepCodeTestCommand { get; set; }
///
/// 保存扫码ROI信息
///
public DelegateCommand SeaveSweepCodeROICommand { get; set; }
#region 码类型集合
private List codeTypeList;
///
/// 码类型集合
///
public List CodeTypeList
{
get { return codeTypeList; }
set
{
codeTypeList = value;
this.RaisePropertyChanged("CodeTypeList");
}
}
#endregion
#region Code码制集合
private List codeList;
///
/// Code码制集合
///
public List CodeList
{
get { return codeList; }
set
{
codeList = value;
this.RaisePropertyChanged("CodeList");
}
}
#endregion
#region 码型 1:二维码 2:条形码
private int selectCodeTypeID;
///
/// 码型 1:二维码 2:条形码
///
public int SelectCodeTypeID
{
get { return selectCodeTypeID; }
set
{
selectCodeTypeID = value;
if (value == 1) //二维码扫描
{
CodeList = new List() { "QR Code", "Micro QR Code", "PDF417", "Aztec Code", "Data Matrix ECC 200" };
}
else if (value == 2)
{
CodeList = new List() { "auto", "EAN-13", "Code 39", "GS1 DataBar Omnidir" };
}
else
{
CodeList = new List();
}
this.RaisePropertyChanged("SelectCodeTypeID");
}
}
#endregion
#region 码制
private string selectCodeStr;
///
/// 码制
///
public string SelectCodeStr
{
get { return selectCodeStr; }
set
{
selectCodeStr = value;
if (QRModelInitialize && !string.IsNullOrEmpty(value))
{
QRModelInitialize = false;
}
this.RaisePropertyChanged("SelectCodeStr");
}
}
#endregion
///
/// 扫码模块初始化
///
public void SweepCodeInitialize()
{
CodeTypeList = new List() { new CommonClass() { ID = 1, CommonName = "二维码" }, new CommonClass() { ID = 2, CommonName = "条形码" } };
CreateSweepCodeROICommand = new DelegateCommand();
CreateSweepCodeROICommand.ExecuteAction = new Action