Пример #1
0
        // feedback containers are named turnXfeedback
        private void AddFeedBackMarker(Color colour, int pegNumber)
        {
            Debug.WriteLine("Adding feedbackpeg!!");
            // set a string to search for
            string qryString = "turn" + current_turn + "feedbackpeg" + pegNumber;
            // add a peg to the feedback container
            Ellipse fbPegLocation = FindName(qryString) as Ellipse;
            // now add a new Peg to the same parent and grid positions

            // feedback pegs will (should) be called turnXfeedbackpegYpegY
            PegWrapper pegWrapper = new PegWrapper(
                qryString + "peg",
                pegNumber,
                new SolidColorBrush(colour),
                FEEDBACK_PEG_SIZE
                );

            // TODO: maybe add a method for figuring this out. it could also
            // be used for building the feedback containers initialy
            if (pegNumber == 1)
            {
                pegWrapper.Peg.SetValue(Grid.ColumnProperty, 0);
                pegWrapper.Peg.SetValue(Grid.RowProperty, 0);
            }
            else if (pegNumber == 2)
            {
                pegWrapper.Peg.SetValue(Grid.ColumnProperty, 1);
                pegWrapper.Peg.SetValue(Grid.RowProperty, 0);
            }
            else if (pegNumber == 3)
            {
                pegWrapper.Peg.SetValue(Grid.ColumnProperty, 0);
                pegWrapper.Peg.SetValue(Grid.RowProperty, 1);
            }
            else if (pegNumber == 4)
            {
                pegWrapper.Peg.SetValue(Grid.ColumnProperty, 1);
                pegWrapper.Peg.SetValue(Grid.RowProperty, 1);
            }

            FeedbackContainer fbContainer = FindName("turn" + current_turn + "feedback") as FeedbackContainer;

            Debug.WriteLine(fbContainer.Name);
            fbContainer.Children.Add(pegWrapper.Peg);
        }
Пример #2
0
        public TurnContainer(int turnNumber)
        {
            this.turnNumber = turnNumber;
            this.Padding    = new Thickness(5);

            this.BorderBrush     = MainPage.BORDER_BG;
            this.BorderThickness = new Thickness(MainPage.BORDER_THICKNESS);

            this.Background = MainPage.SECONDARY_BG;

            this.Orientation         = Orientation.Horizontal;
            this.HorizontalAlignment = HorizontalAlignment.Right;

            this.Name = "turn" + turnNumber;

            this.feedBackContainer = new FeedbackContainer(this);
            this.Children.Add(feedBackContainer);

            this.pegContainer = new PegContainer(this, pegContainerSize);
            this.Children.Add(this.pegContainer);

            //MainPage.TURN_CONTAINER_WIDTH = this.Width;
        }