Exemple #1
0
 internal void AddMoreMaterials(Conveyor conveyor)
 {
     IsFree = false;
     conveyor.UpdateState(ConveyorState.AddMaterials);
     Thread.Sleep(1000);
     IsFree = true;
 }
Exemple #2
0
 public void Repair(Conveyor conveyor)
 {
     lock (Locker)
     {
         IsFree = false;
         conveyor.UpdateState(ConveyorState.InRepairing);
         Thread.Sleep(2000);
         IsFree = true;
     }
 }
Exemple #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);
        }
Exemple #4
0
        private void HandleUpdate(Conveyor caller, ConveyorState state)
        {
            var pos = Conveyors.FindIndex(conveyor => conveyor == caller);

            UpdateView?.Invoke(pos, state, Loader.IsFree, Mechanic.IsFree);
        }
Exemple #5
0
 private void HandleRepair(Conveyor caller)
 {
     Mechanic.Repair(caller);
 }
Exemple #6
0
 private void HandleAddMaterials(Conveyor caller)
 {
     Loader.AddMoreMaterials(caller);
 }