Ejemplo n.º 1
0
        public void editDisabledOrders(Territory passedTerritory, Button button)
        {
            button.IsEnabled = false;
            OrderToken newOrder = resources.buttonOrderTokenDict[button];
            foreach (OrderToken o in passedTerritory.getHouseOccupied().getAvailableOrderTokens())
            {
                if (o.Equals(newOrder))
                { 
                    newOrder = o;
                    break;
                }
            }
            newOrder.setIsAvailable(false);
            passedTerritory.getHouseOccupied().getAvailableOrderTokens().Remove(newOrder);

            if (!(passedTerritory.getOrderToken() is PlaceHolderOrderToken))
            {
                passedTerritory.getOrderToken().setIsAvailable(true);
                passedTerritory.getHouseOccupied().getAvailableOrderTokens().Add(passedTerritory.getOrderToken());  
                foreach (OrderToken o1 in resources.allOrderTokens)
                {
                    if (o1.Equals(passedTerritory.getOrderToken()) && !(resources.orderTokenButtonDict[o1].IsEnabled))
                    {
                        resources.orderTokenButtonDict[o1].IsEnabled = true;
                        break;
                    }
                }
            }
            passedTerritory.setOrderToken(newOrder);
        }