Пример #1
0
        public PageTipBoxRackModel(PageTipBoxRackViewModel viewModel, PageTipBoxRackView view)
        {
            this.ViewModel = viewModel;
            this.View      = view;

            //初始化界面并展示和吸头消息管理类中字典对应
            init();
        }
Пример #2
0
 /// <summary>
 /// 更新当前板架和选择板架内容信息
 /// </summary>
 private void CurrentRackAndSelRackUpdate()
 {
     if (WindowStartViewController.Instance != null && WindowStartViewController.Instance.PageSuckerRack != null)
     {
         PageTipBoxRackView view = WindowStartViewController.Instance.PageSuckerRack as PageTipBoxRackView;
         view.ViewModel.Model.UpdateCurrentRack(tipBoxRackDict[currentRackName]);
         view.ViewModel.Model.UpdateRack(tipBoxRackDict[currentRackName]);
     }
 }
Пример #3
0
        public PageTipBoxRackViewModel(PageTipBoxRackView view)
        {
            Model = new PageTipBoxRackModel(this, view);

            SmallRadioBtnClicked = new DelegateCommand();
            SmallRadioBtnClicked.ExecuteCommand = new Action <object>(Model.SmallRadioBtnClick);

            BigRadioBtnClicked = new DelegateCommand();
            BigRadioBtnClicked.ExecuteCommand = new Action <object>(Model.BigRadioBtnClick);

            FullBtnClicked = new DelegateCommand();
            FullBtnClicked.ExecuteCommand = new Action <object>(Model.FullBtnClick);

            ClearBtnClicked = new DelegateCommand();
            ClearBtnClicked.ExecuteCommand = new Action <object>(Model.ClearBtnClick);

            SaveBtnClicked = new DelegateCommand();
            SaveBtnClicked.ExecuteCommand = new Action <object>(Model.SaveBtnClick);
        }
Пример #4
0
        public object Execute(int eventCode, object message)
        {
            object obj = null;

            switch (eventCode)
            {
            //获取当前板架模型
            case TipBoxRackEventCode.GETCURRENTRACKMODEL:
            {
                if (tipBoxRackDict.ContainsKey(currentRackName))
                {
                    obj = tipBoxRackDict[currentRackName];
                }
            }
            break;

            //获取板架模型
            case TipBoxRackEventCode.GETRACKMODEL:
            {
                if (tipBoxRackDict.ContainsKey(message.ToString()))
                {
                    obj = tipBoxRackDict[message.ToString()];
                }
            }
            break;

            //设置当前板架
            case TipBoxRackEventCode.SETCURRENTRACK:
            {
                if (!message.ToString().Equals(currentRackName) && WindowStartViewController.Instance != null && WindowStartViewController.Instance.PageSuckerRack != null)
                {
                    //设置当前板架名称
                    currentRackName = message.ToString();
                    PageTipBoxRackView view = WindowStartViewController.Instance.PageSuckerRack as PageTipBoxRackView;
                    //更新当前板架信息
                    view.ViewModel.Model.UpdateCurrentRack(tipBoxRackDict[currentRackName]);
                }
            }
            break;

            //设置孔信息
            case TipBoxRackEventCode.SETHOLE:
            {
                HoleDto         dto   = message as HoleDto;
                TipBoxRackModel model = null;
                if ("CurrentTipRack".Equals(dto.RackName))
                {
                    model = tipBoxRackDict[currentRackName];
                }
                else
                {
                    model = tipBoxRackDict[dto.RackName];
                }
                model.RackDataList[dto.Index] = dto.Hole;

                //通知界面更新
                if (WindowStartViewController.Instance != null && WindowStartViewController.Instance.PageSuckerRack != null)
                {
                    PageTipBoxRackView view = WindowStartViewController.Instance.PageSuckerRack as PageTipBoxRackView;
                    if ("CurrentTipRack".Equals(dto.RackName))
                    {
                        view.ViewModel.Model.UpdateCurrentRack(tipBoxRackDict[currentRackName]);
                        view.ViewModel.Model.UpdateRack(tipBoxRackDict[currentRackName]);
                    }
                    else
                    {
                        view.ViewModel.Model.UpdateRack(tipBoxRackDict[currentRackName]);
                    }
                }
            }
            break;

            //设置大吸头板
            case TipBoxRackEventCode.SETBIGRACK:
            {
                tipBoxRackDict[currentRackName].RackType = 0;
                CurrentRackAndSelRackUpdate();
            }
            break;

            //设置小吸头板
            case TipBoxRackEventCode.SETSMALLRACK:
            {
                tipBoxRackDict[currentRackName].RackType = 2;
                CurrentRackAndSelRackUpdate();
            }
            break;

            //填满吸头板
            case TipBoxRackEventCode.FULLRACK:
            {
                List <int> dataList = tipBoxRackDict[currentRackName].RackDataList;
                for (int i = 0; i < dataList.Count; i++)
                {
                    dataList[i] = 1;
                }
                CurrentRackAndSelRackUpdate();
            }
            break;

            //清空吸头板
            case TipBoxRackEventCode.CLEARRACK:
            {
                List <int> dataList = tipBoxRackDict[currentRackName].RackDataList;
                for (int i = 0; i < dataList.Count; i++)
                {
                    dataList[i] = 0;
                }
                CurrentRackAndSelRackUpdate();
            }
            break;

            //保存配置文件
            case TipBoxRackEventCode.SAVEFILE:
            {
                saveFile();
            }
            break;

            //获取一个可用吸头
            case TipBoxRackEventCode.GETUSETIP:
            {
                obj = getUseTip(message.ToString());
            }
            break;

            case TipBoxRackEventCode.SETNOHOLE:
            {
                HoleDto         dto   = message as HoleDto;
                TipBoxRackModel model = null;

                //if ("CurrentTipRack".Equals(dto.RackName))
                //    model = tipBoxRackDict[currentRackName];
                //else
                model = tipBoxRackDict[dto.RackName];
                model.RackDataList[dto.Index] = 0;

                //通知界面更新
                if (WindowStartViewController.Instance != null && WindowStartViewController.Instance.PageSuckerRack != null)
                {
                    PageTipBoxRackView view = WindowStartViewController.Instance.PageSuckerRack as PageTipBoxRackView;
                    if (currentRackName.Equals(dto.RackName))
                    {
                        view.ViewModel.Model.UpdateCurrentRack(tipBoxRackDict[currentRackName]);
                        view.ViewModel.Model.UpdateRack(tipBoxRackDict[currentRackName]);
                    }
                    else
                    {
                        view.ViewModel.Model.UpdateRack(tipBoxRackDict[dto.RackName]);
                    }
                }
            }
            break;

            default:
                break;
            }
            return(obj);
        }