Exemplo n.º 1
0
        private void HandleCurrentShipPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(IShip.CurrentShipOrder) || e.PropertyName == null)
            {
                if (_currentShipOrder != null)
                {
                    ((INotifyCollectionChanged)_currentShipOrder.MovementOrders).CollectionChanged -= HandleCurrentMovementOrdersChanged;
                }

                _currentShipOrder = _currentShip.CurrentShipOrder;

                ((INotifyCollectionChanged)_currentShipOrder.MovementOrders).CollectionChanged += HandleCurrentMovementOrdersChanged;
                HandleCurrentMovementOrdersChanged(this, null);
                PropertyChanged.Raise(() => TotalTimeForOrder);
                PropertyChanged.Raise(() => CurrentMovementOrders);
                PropertyChanged.Raise(() => RequestedSailLevelChange);
            }
        }
Exemplo n.º 2
0
        private static Stack <MovementOrder> CreateMovementOrderStack(IShipOrderReadOnly shipOrder)
        {
            var copiedMovementOrders = shipOrder.MovementOrders.Select(order => order.Copy()).Reverse();

            return(new Stack <MovementOrder>(copiedMovementOrders));
        }