using Aitex.Core.UI.MVVM;
using CyberX8_Core;
using CyberX8_MainPages.Roles;
using CyberX8_MainPages.Views;
using MECF.Framework.Common.ControlDataContext;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.OperationCenter;
using MECF.Framework.Common.Utilities;
using OpenSEMI.ClientBase.Command;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Threading;
namespace CyberX8_MainPages.ViewModels
{
    public class RobotCycleViewModel : BindableBase
    {
        #region 内部变量
        /// 
        /// 选择的LP
        /// 
        private ModuleName _selectedLPName = ModuleName.LP1;
        private ModuleName _selectedAlignerName = ModuleName.Aligner1;
        /// 
        /// 选择的Dummy
        /// 
        private ModuleName _selectedDummyName = ModuleName.Dummy1;
        private ModuleName _selectedSrdName = ModuleName.SRD1;
        private ModuleName _selectedPufName = ModuleName.PUF1;
        /// 
        /// 输入的Cycle次数
        /// 
        private int _inPutCycleTimes = 1;
        /// 
        /// Align调整角度度数
        /// 
        private int _inPutAlignDegree = 0;
        /// 
        /// 当前正在执行第几次Cycle
        /// 
        private int _currentCycle;
        /// 
        /// 是否选中dummy
        /// 
        private bool _isDummySelected = false;
        /// 
        /// 是否选中srd
        /// 
        private bool _isSrdSelected = false ;
        /// 
        /// 是否选中puf
        /// 
        private bool _isPufSelected = false;
        #region 系统数据
        /// 
        /// 定时器
        /// 
        DispatcherTimer _timer;
        /// 
        /// 查询后台数据集合
        /// 
        private List _rtDataKeys = new List();
        /// 
        /// rt查询key数值字典
        /// 
        private Dictionary _rtDataValueDic = new Dictionary();
        #endregion
        #endregion
        #region 属性
        public ModuleName SelectedLPName
        {
            get { return _selectedLPName; }
            set { SetProperty(ref _selectedLPName, value); }
        }
        public ModuleName SelectedAlignerName
        {
            get { return _selectedAlignerName; }
            set { SetProperty(ref _selectedAlignerName, value); }
        }
        public ModuleName SelectedDummyName
        {
            get { return _selectedDummyName; }
            set { SetProperty(ref _selectedDummyName, value); }
        }
        public ModuleName SelectedSrdName
        {
            get { return _selectedSrdName; }
            set { SetProperty(ref _selectedSrdName, value); }
        }
        public ModuleName SelectedPufName
        {
            get { return _selectedPufName; }
            set { SetProperty(ref _selectedPufName, value); }
        }
        public int InPutCycleTimes
        {
            get { return _inPutCycleTimes; }
            set { SetProperty(ref _inPutCycleTimes, value); }
        }
        public int CurrentCycle
        {
            get { return _currentCycle; }
            set { SetProperty(ref _currentCycle, value); }
        }
        public int InPutAlignDegree
        {
            get { return _inPutAlignDegree; }
            set { SetProperty(ref _inPutAlignDegree, value); }
        }
        public bool IsDummySelected
        {
            get { return _isDummySelected; }
            set { SetProperty(ref _isDummySelected, value); }
        }
        public bool IsSrdSelected
        {
            get { return _isSrdSelected; }
            set { SetProperty(ref _isSrdSelected, value); }
        }
        public bool IsPufSelected
        {
            get { return _isPufSelected; }
            set { SetProperty(ref _isPufSelected, value); }
        }
        #endregion
        #region 命令
        public ICommand RobotCycleStartCommand { get; set; }
  
        public ICommand RobotCycleAbortCommand { get; set; }
        public ICommand LPChangeCommand { get; set; }
 
        public ICommand AlignerChangeCommand { get; set; }
        
        public ICommand PufChangeCommand { get; set; }
   
        public ICommand DummyChangeCommand { get; set; }
        
        public ICommand SrdChangeCommand { get; set; }
        #endregion
        /// 
        /// 构造器
        /// 
        public RobotCycleViewModel() 
        {
            RobotCycleStartCommand = new DelegateCommand