Exemple #1
0
        public GroupWindow(Group group, PilePosition position, int count)
            : this()
        {
            _shouldShuffleOnClose = false;
            _id         = Program.GameEngine.GetUniqueId();
            _position   = position;
            _count      = count;
            DataContext = _group = group;

            switch (position)
            {
            case PilePosition.All:
                Title           = group.FullName;
                cardsList.Cards = group.Cards;
                break;

            case PilePosition.Top:
                Title                  = string.Format("{0} Top {1} cards", group.FullName, count);
                cardsList.Cards        = new ObservableCollection <Card>(group.Take(count));
                cardsList.RestrictDrop = true;
                break;

            case PilePosition.Bottom:
                Title                  = string.Format("{0} Bottom {1} cards", group.FullName, count);
                cardsList.Cards        = new ObservableCollection <Card>(group.Skip(Math.Max(0, group.Count - count)));
                cardsList.RestrictDrop = true;
                break;
            }

            if (cardsList.Cards != group.Cards)
            {
                ((INotifyCollectionChanged)group.Cards).CollectionChanged += CardsChanged;
            }

            // The shuffle link is confusing at best when a subset of the group is displayed
            if (position != PilePosition.All)
            {
                shuffleLink.Visibility = Visibility.Collapsed;
            }

            // If the whole group is visible to everyone, there's nothing to be done, really.
            if (group.Visibility == DataNew.Entities.GroupVisibility.Everybody)
            {
                return;
            }

            SendLookAtRpc(true);
        }
Exemple #2
0
        public GroupWindow(Group group, PilePosition position, int count)
            : this()
        {
            _shouldShuffleOnClose = false;
            _id = Program.GameEngine.GetUniqueId();
            _position = position;
            _count = count;
            DataContext = _group = group;

            switch (position)
            {
                case PilePosition.All:
                    Title = group.FullName;
                    cardsList.Cards = group.Cards;
                    break;
                case PilePosition.Top:
                    Title = string.Format("{0} Top {1} cards", group.FullName, count);
                    cardsList.Cards = new ObservableCollection<Card>(group.Take(count));
                    cardsList.RestrictDrop = true;
                    break;
                case PilePosition.Bottom:
                    Title = string.Format("{0} Bottom {1} cards", group.FullName, count);
                    cardsList.Cards = new ObservableCollection<Card>(group.Skip(Math.Max(0, group.Count - count)));
                    cardsList.RestrictDrop = true;
                    break;
            }

            if (cardsList.Cards != group.Cards)
                ((INotifyCollectionChanged) group.Cards).CollectionChanged += CardsChanged;

            // The shuffle link is confusing at best when a subset of the group is displayed
            if (position != PilePosition.All)
                shuffleLink.Visibility = Visibility.Collapsed;

            // If the whole group is visible to everyone, there's nothing to be done, really.
            if (group.Visibility == DataNew.Entities.GroupVisibility.Everybody)
                return;

            SendLookAtRpc(true);
        }