| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 | using Aitex.Core.Util;using MECF.Framework.Common.OperationCenter;using MECF.Framework.UI.Client.ClientBase;using System.Collections.Generic;using System.Collections.ObjectModel;using System.Linq;using System.Windows;using FurnaceUI.Models;using FurnaceUI.Views.Recipes;namespace FurnaceUI.Views.Operations{    public class WaferRobotWaferViewModel : FurnaceUIViewModelBase    {        private ObservableCollection<BoatWaferItem> _waferRobotWafers;        public ObservableCollection<BoatWaferItem> WaferRobotWafers        {            get { return _waferRobotWafers; }            set            {                _waferRobotWafers = value;                NotifyOfPropertyChange("WaferRobotWafers");            }        }        private PeriodicJob RefreshBoatWafers;        public WaferRobotWaferViewModel()        {            WaferRobotWafers = new ObservableCollection<BoatWaferItem>();            for (int i = 0; i < 5; i++)            {                BoatWaferItem item = new BoatWaferItem() { Slot = i + 1, Description = "" };                WaferRobotWafers.Add(item);            }            RefreshBoatWafers = new PeriodicJob(300, RefreshBoatWafersTask, "RefreshAlarmTask", true);        }        protected override void OnInitialize()        {            base.OnInitialize();        }        protected override void OnActivate()        {            base.OnActivate();        }        protected override void InvokeAfterUpdateProperty(Dictionary<string, object> data)        {            base.InvokeAfterUpdateProperty(data);        }        private bool RefreshBoatWafersTask()        {            var wafers = ModuleManager.ModuleInfos["WaferRobot"].WaferManager.Wafers.ToList();            for (int i = 0; i < WaferRobotWafers.Count; i++)            {                if (ModuleManager.ModuleInfos["WaferRobot"].WaferManager.Wafers.Count > i)                {                    var wafer = wafers[i];                    if (wafer.WaferStatus == 0)//empty                    {                        WaferRobotWafers[i].Description = $"";                        WaferRobotWafers[i].HasWafer = false;                        WaferRobotWafers[i].NoWafer = true;                    }                    else                    {                        WaferRobotWafers[i].Description = $"{wafer.SourceName}--{wafer.WaferType }";                        WaferRobotWafers[i].HasWafer = true;                        WaferRobotWafers[i].NoWafer = false;                    }                }            }            return true;        }        public void CreateWafer(BoatWaferItem item)        {            InvokeClient.Instance.Service.DoOperation("CreateWafer", "WaferRobot", item.Slot - 1);        }        public void DeleteWafer(BoatWaferItem item)        {            InvokeClient.Instance.Service.DoOperation("DeleteWafer", "WaferRobot", item.Slot - 1);        }        public void CloseCmd()        {            ((Window)GetView()).Close();        }    }}
 |