Exemplo n.º 1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl = ((HangCards_GUI.CardControl)(target));
                return;

            case 2:
                this.SuitLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 3:
                this.RankLabel = ((System.Windows.Controls.Label)(target));
                return;

            case 4:
                this.RankLabelInverted = ((System.Windows.Controls.Label)(target));
                return;

            case 5:
                this.TopRightImage = ((System.Windows.Controls.Image)(target));
                return;

            case 6:
                this.BottomLeftImage = ((System.Windows.Controls.Image)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemplo n.º 2
0
        public GameClient()
        {
            InitializeComponent();

            var position = new Point(15, 15);

            for (var i = 0; i < 4; i++)
            {
                var suit = (CardLib.Suit)i;
                position.Y = 15;
                for (int rank = 1; rank < 14; rank++)
                {
                    position.Y += 30;
                    var card = new CardControl(new CardLib.Card((Suit)suit, (Rank)rank));
                    card.VerticalAlignment   = VerticalAlignment.Top;
                    card.HorizontalAlignment = HorizontalAlignment.Left;
                    card.Margin = new Thickness(position.X, position.Y, 0, 0);
                    contentGrid.Children.Add(card);
                }
                position.X += 122;
            }
        }