public void LoadFrame(FrameInfoCP thisFrame)
        {
            if (thisFrame.SectionList.Count != 3)
            {
                throw new BasicBlankException("Must have 3 sections, not " + thisFrame.SectionList.Count);
            }
            _thisGrid = new Grid();
            int x;

            for (x = 1; x <= 3; x++)
            {
                GridHelper.AddLeftOverColumn(_thisGrid, 1);
                if (x < 3)
                {
                    GridHelper.AddLeftOverRow(_thisGrid, 1);// for equal
                }
            }
            BlankBowlingBorderXF mainOne = new BlankBowlingBorderXF();

            _thisGrid.Children.Add(mainOne);
            Grid.SetRowSpan(mainOne, 2);
            Grid.SetColumnSpan(mainOne, 3);
            Label thisLabel = new Label();

            thisLabel.BindingContext = thisFrame;
            Binding thisBind = new Binding(nameof(FrameInfoCP.Score));
            var     thisCon  = new BowlingConverterXF();

            thisBind.Converter  = thisCon;
            thisLabel.TextColor = Color.White;
            thisLabel.SetBinding(Label.TextProperty, thisBind);
            thisLabel.FontSize = 10;
            GridHelper.AddControlToGrid(_thisGrid, thisLabel, 1, 0);
            Grid.SetColumnSpan(thisLabel, 3); // use all 3 columns
            thisLabel.HorizontalOptions = LayoutOptions.Center;
            int SectionSize = 20;             // trial and error

            for (x = 1; x <= 3; x++)
            {
                BlankBowlingBorderXF thisBlank = new BlankBowlingBorderXF();
                thisBlank.WidthRequest  = SectionSize;
                thisBlank.HeightRequest = 13;
                GridHelper.AddControlToGrid(_thisGrid, thisBlank, 0, x - 1);
                thisLabel                   = new Label();
                thisLabel.TextColor         = Color.White;
                thisLabel.HorizontalOptions = LayoutOptions.Center;
                thisLabel.FontSize          = 10;
                thisLabel.HeightRequest     = 13;
                thisLabel.SetBinding(Label.TextProperty, new Binding(nameof(SectionInfoCP.Score)));
                thisLabel.BindingContext = thisFrame.SectionList[x]; // not 0 based because of dictionary.  the key starts with 1
                GridHelper.AddControlToGrid(_thisGrid, thisLabel, 0, x - 1);
            }
            Content = _thisGrid;
        }
        public GameboardXF(MinesweeperMainGameClass gameBoard)
        {
            _thisGrid = new Grid();
            int x;

            for (x = 1; x <= 9; x++)
            {
                GridHelper.AddLeftOverColumn(_thisGrid, 1);
                GridHelper.AddLeftOverRow(_thisGrid, 1); // to make them even.
            }
            Content    = _thisGrid;
            _gameBoard = gameBoard;
        }
Пример #3
0
        public void LoadList(RummyDiceHandVM thisMod, RummyDiceMainGameClass mainGame)
        {
            _thisMod    = thisMod;
            _mainGame   = mainGame;
            DataContext = thisMod;
            _handList   = thisMod.HandList;
            _handList.CollectionChanged += HandList_CollectionChanged;
            Text = $"Temp Set {thisMod.Index}";
            SetBinding(IsEnabledProperty, nameof(RummyDiceHandVM.IsEnabled));
            RummyDiceInfo firstDice = new RummyDiceInfo();

            if (firstDice.HeightWidth == 0)
            {
                throw new BasicBlankException("You must specify the height/width of the dice");
            }
            IProportionImage thisI     = new CustomProportionWPF();
            SKSize           firstSize = new SKSize(firstDice.HeightWidth, firstDice.HeightWidth);
            var  sizeUsed  = firstSize.GetSizeUsed(thisI.Proportion);
            Grid firstGrid = new Grid();

            GridHelper.AddPixelRow(firstGrid, (int)sizeUsed.Height + 50);
            GridHelper.AddLeftOverRow(firstGrid, 1);
            Margin                 = new Thickness(3, 3, 3, 3);
            _thisStack             = new StackPanel();
            _thisStack.Orientation = Orientation.Horizontal;
            Button thisBut = GetGamingButton("Place Tiles", nameof(RummyDiceHandVM.BoardCommand));

            //i think since its a different view model, has to do manually.
            thisBut.Name    = "";
            thisBut.Command = thisMod.BoardCommand;
            thisBut.Margin  = new Thickness(5, 5, 5, 5);
            GridHelper.AddControlToGrid(firstGrid, _thisStack, 0, 0);
            GridHelper.AddControlToGrid(firstGrid, thisBut, 1, 0);
            _thisGrid = new Grid();
            //hopefully does not need visible.  if we need visible, rethink.


            //SetBinding(VisibilityProperty, GetVisibleBinding(nameof(RummyDiceHandVM.Visible)));
            _thisGrid.Children.Add(ThisDraw);
            _thisGrid.Children.Add(firstGrid);
            var thisRect = ThisFrame.GetControlArea();

            _thisStack.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 10, 3, 3);
            Width             = 1520; //different on xamarin forms.
            Height            = 250;
            PopulateControls();       //just in case there is something to start with.
            Content = _thisGrid;
        }
        public GameboardWPF(MinesweeperMainGameClass gameBoard)
        {
            _thisGrid = new Grid();
            //_thisDraw = new SKElement();
            //_thisDraw.PaintSurface += PaintSurface;
            //_thisGrid.Children.Add(_thisDraw);
            //Grid.SetColumnSpan(_thisDraw, 9);
            //Grid.SetRowSpan(_thisDraw, 9);
            // needs to be 9 by 9
            int x;

            for (x = 1; x <= 9; x++)
            {
                GridHelper.AddLeftOverColumn(_thisGrid, 1);
                GridHelper.AddLeftOverRow(_thisGrid, 1); // to make them even.
            }
            Content    = _thisGrid;
            _gameBoard = gameBoard;
        }