using Model.Vision;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Community;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
using Views.Vision;
using MahApps.Metro.Controls.Dialogs;
namespace ViewModel.Vision
{
///
/// 功能编辑
///
partial class HalconVisual
{
#region 功能显示控件
private UserControl showControl;
///
/// 功能显示控件
///
public UserControl ShowControl
{
get { return showControl; }
set
{
showControl = value;
this.RaisePropertyChanged("ShowControl");
}
}
#endregion
#region 选中的视觉工程项目
private VisualEngineering selectVE;
///
/// 选中的视觉工程项目
///
public VisualEngineering SelectVE
{
get { return selectVE; }
set
{
selectVE = value;
this.RaisePropertyChanged("SelectVE");
}
}
#endregion
#region 选中的视觉工程项目功能
private VisualEngineeringItems selectVEI;
///
/// 选中的视觉工程项目功能
///
public VisualEngineeringItems SelectVEI
{
get { return selectVEI; }
set
{
selectVEI = value;
ControlDeployment(value);
this.RaisePropertyChanged("SelectVEI");
}
}
///
/// 功能显示控件调度
///
///
private void ControlDeployment(VisualEngineeringItems value)
{
if (value != null && value.ID > 0)
{
SelectModel = value.MyRectangleModel;
switch (value.HandleType)
{
case 1:
ShowControl = new V_ScanCode();
break;
case 2:
ShowControl = new V_Location();
break;
case 3:
ShowControl = new V_Inspect();
break;
case 4:
ShowControl = new V_Measure();
break;
case 5:
ShowControl = new V_OCR();
break;
}
}
else
{
ShowControl = null;
}
}
#endregion
#region 各种方法
///
/// 新增工程
///
public DelegateCommand AddVeCommand { get; set; }
///
/// 更新工程项目
///
public DelegateCommand UpdateVeCommand { get; set; }
///
/// 删除工程
///
public DelegateCommand DeleteVeCommand { get; set; }
///
/// 新增视觉工程项目
///
public DelegateCommand AddVeiCommand { get; set; }
///
/// 保存视觉工程项目
///
public DelegateCommand UpdateVeiCommand { get; set; }
///
/// 删除视觉功能项目
///
public DelegateCommand DeleteVeiCommand { get; set; }
#endregion
#region 初始化视觉工程项目编辑类
///
/// 初始化视觉工程项目编辑类
///
private void InitializationFunctionEditing()
{
AddVeCommand = new DelegateCommand();
AddVeCommand.ExecuteAction = new Action