public void Add()
        {
            var instance = (IConveyor)Activator.CreateInstance(ConveyorsOptions[SelectedConveyorIndex]);

            instance.OnCrashChanged += Instance_OnCrashChanged;
            Conveyors.Add(instance);
            RaisePropertyChanged(nameof(Conveyors));
        }
        public void Stop(IConveyor conveyor)
        {
            int index = Conveyors.IndexOf(conveyor);

            Conveyors.Remove(conveyor);
            conveyor.Stop();
            Conveyors.Insert(index, conveyor);
            RaisePropertyChanged(nameof(Conveyors));
        }
Пример #3
0
        public async void AddNewConveyor()
        {
            var conveyor = new Conveyor();

            conveyor.AddMaterials += HandleAddMaterials;
            conveyor.Repair       += HandleRepair;
            conveyor.Update       += HandleUpdate;
            Conveyors.Add(conveyor);
            ConveyorAdded?.Invoke(conveyor);
            await Task.Run(conveyor.StartWorking);
        }
 private void Instance_OnCrashChanged(IConveyor obj)
 {
     Application.Current.Dispatcher.Invoke(
         () =>
     {
         int index = Conveyors.IndexOf(obj);
         Conveyors.Remove(obj);
         Conveyors.Insert(index, obj);
         RaisePropertyChanged(nameof(Conveyors));
     },
         System.Windows.Threading.DispatcherPriority.Send);
 }
 private void Factory_OnSugarChanged(IConveyor conveyor)
 {
     Application.Current.Dispatcher.Invoke(
         () =>
     {
         RaisePropertyChanged(nameof(Factory));
         Messenger.Default.Send(new SugarTakenMessage
         {
             Conveyor      = conveyor,
             ConveyorIndex = Conveyors.IndexOf(conveyor)
         });
     },
         System.Windows.Threading.DispatcherPriority.Send);
 }
Пример #6
0
 void Convey_OnDataChanged(object sender, DataChangedEventArgs e)
 {
     if (e.State == null)
         return;
     string[] str = e.ItemName.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
     string ConveyID = str[0];
     string ChangeName = str[1];
     GetConveyor(ConveyID);
     if (ChangeName.IndexOf("TaskNo") >= 0)
     {
         object[] obj = ObjectUtil.GetObjects(e.State);
         string TaskNo = obj[0].ToString() + obj[1].ToString().PadLeft(4, '0') + obj[2].ToString().PadLeft(4, '0');
         dicConvey[ConveyID].TaskNo = TaskNo;
     }
     else if (ChangeName.IndexOf("PalletCode") >= 0)
         dicConvey[ConveyID].PalletCode = e.State.ToString();
     Conveyors.ConveyorInfo(dicConvey[ConveyID]);
 }
Пример #7
0
        void Conveyor_OnDataChanged(object sender, DataChangedEventArgs e)
        {
            try
            {
                if (e.State == null)
                {
                    return;
                }

                string   txt      = e.ItemName.Split('_')[0];
                Conveyor conveyor = GetConveyorByID(txt);
                conveyor.value = e.State.ToString();

                conveyor.ID = txt;


                Conveyors.ConveyorInfo(conveyor);
            }
            catch (Exception ex)
            {
                MCP.Logger.Error("输送线监控界面中Conveyor_OnDataChanged出现异常" + ex.Message);
            }
        }
Пример #8
0
 private void ConveyorAdded(Conveyor conveyor)
 {
     Conveyors.Add(new ConveyorVm(Conveyors.Count, conveyor));
 }
Пример #9
0
 private void PaintConveyors(Graphics g)
 {
     Conveyors.ForEach(vm => { vm.Paint(g); });
 }
Пример #10
0
        private void HandleUpdate(Conveyor caller, ConveyorState state)
        {
            var pos = Conveyors.FindIndex(conveyor => conveyor == caller);

            UpdateView?.Invoke(pos, state, Loader.IsFree, Mechanic.IsFree);
        }
 public void Delete(IConveyor conveyor)
 {
     conveyor.Stop();
     Conveyors.Remove(conveyor);
     RaisePropertyChanged(nameof(Conveyors));
 }
Пример #12
0
 public void DeleteConveyor(IConveyor conveyor)
 {
     Conveyors.Remove(conveyor);
     conveyor.Stop();
 }
Пример #13
0
 public void AddConveyor(IConveyor conveyor)
 {
     Conveyors.Add(conveyor);
     conveyor.Start(this);
 }