コード例 #1
0
        protected override void Move()
        {
            _timer.Stop();

            if (CanMove())
            {
                if (LastBaggage != null)
                {
                    NextLink.PassBaggage(LastBaggage);
                    _conveyorBelt[LastIndex] = null;
                }

                for (int i = LastIndex; i > 0; i--)
                {
                    _conveyorBelt[i]     = _conveyorBelt[i - 1];
                    _conveyorBelt[i - 1] = null;
                }

                NextLink.OnStatusChangedToFree -= Move;
                Status = NodeState.Free;
                _timer.Start();
            }
            else
            {
                NextLink.OnStatusChangedToFree += Move;
            }
        }
コード例 #2
0
        protected override void Move()
        {
            _timer.Stop();

            if (CanMove())
            {
                if (LastBaggage != null)
                {
                    NextLink.PassBaggage(LastBaggage);
                    _conveyorBelt[LastIndex] = null;
                }

                for (int i = LastIndex; i > 0; i--)
                {
                    _conveyorBelt[i]     = _conveyorBelt[i - 1];
                    _conveyorBelt[i - 1] = null;
                }

                NextLink.OnStatusChangedToFree -= Move;
                foreach (var kvp in _statusChangedToFreeEvents)
                {
                    if (_conveyorBelt[kvp.Key] == null)
                    {
                        kvp.Value?.Invoke();
                    }
                }

                _timer.Start();
            }
            else
            {
                NextLink.OnStatusChangedToFree += Move;
            }
        }
コード例 #3
0
 private void Move()
 {
     if (NextLink.Status == NodeState.Free && _currentBaggage != null)
     {
         NextLink.OnStatusChangedToFree -= Move;
         NextLink.PassBaggage(_currentBaggage);
         Status = NodeState.Free;
     }
     else if (NextLink.Status != NodeState.Free)
     {
         NextLink.OnStatusChangedToFree += Move;
     }
 }
コード例 #4
0
        public void DistributeBaggage()
        {
            if (Baggages.Count > 0)
            {
                if (NextLink.Status == NodeState.Free)
                {
                    var _currentBaggage = Baggages.Dequeue();
                    _currentBaggage.Destination = typeof(Mpa).Name;

                    NextLink.PassBaggage(_currentBaggage);
                }
            }
        }