protected override void FirstSetUp() { var thisScore = new ScoringGuideClassCP(); ThisFrame.Text = "Scoring Guide"; Grid firstGrid = new Grid(); firstGrid.Children.Add(ThisDraw); var thisRect = ThisFrame.GetControlArea(); Grid otherGrid = new Grid(); otherGrid.Margin = new Thickness(thisRect.Left + 3, thisRect.Top + 3, 3, 5); GridHelper.AddLeftOverColumn(otherGrid, 2); GridHelper.AddLeftOverColumn(otherGrid, 2); StackPanel thisStack = new StackPanel(); AddLabel(thisScore.OffenseText, true, thisStack); GridHelper.AddControlToGrid(otherGrid, thisStack, 0, 0); var thisList = thisScore.OffenseList(); thisList.ForEach(item => AddLabel(item, false, thisStack)); thisStack = new StackPanel(); GridHelper.AddControlToGrid(otherGrid, thisStack, 0, 1); thisList = thisScore.DefenseList(); AddLabel(thisScore.DefenseText, true, thisStack); thisList.ForEach(item => AddLabel(item, false, thisStack)); firstGrid.Children.Add(otherGrid); Content = firstGrid; }
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; }
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; }
private readonly DiceListControlXF <D> _diceControl; //hopefully still okay (?) public YahtzeeMainView(IEventAggregator aggregator, YahtzeeVMData <D> model) { _aggregator = aggregator; _aggregator.Publish(this); _model = model; _aggregator.Subscribe(this); _diceControl = new DiceListControlXF <D>(); Grid eGrid = new Grid(); GridHelper.AddLeftOverColumn(eGrid, 50); GridHelper.AddLeftOverColumn(eGrid, 50); ParentSingleUIContainer sheetGrid = new ParentSingleUIContainer(nameof(YahtzeeMainViewModel <D> .CurrentScoresheet)); StackLayout stack = new StackLayout(); stack.Children.Add(sheetGrid); SimpleLabelGridXF firstInfo = new SimpleLabelGridXF(); firstInfo.AddRow("Turn", nameof(YahtzeeMainViewModel <D> .NormalTurn)); firstInfo.AddRow("Roll", nameof(YahtzeeMainViewModel <D> .RollNumber)); // its bound now. firstInfo.AddRow("Status", nameof(YahtzeeMainViewModel <D> .Status)); firstInfo.AddRow("Turn #", nameof(YahtzeeMainViewModel <D> .Round)); // i think stack.Children.Add(firstInfo.GetContent); _score = new ScoreBoardXF(); _score.AddColumn("Points", false, nameof(YahtzeePlayerItem <D> .Points)); _score.HorizontalOptions = LayoutOptions.Start; _score.VerticalOptions = LayoutOptions.Start; var thisRoll = GetGamingButton("Roll Dice", nameof(YahtzeeMainViewModel <D> .RollDiceAsync)); stack.Children.Add(_diceControl); stack.Children.Add(eGrid); StackLayout finalStack = new StackLayout(); GridHelper.AddControlToGrid(eGrid, finalStack, 0, 0); //try this too. finalStack.Children.Add(thisRoll); finalStack.Children.Add(_score); GridHelper.AddControlToGrid(eGrid, firstInfo.GetContent, 0, 1); Content = stack; }
public YahtzeeScoresheetView(ScoreContainer scoreContainer, IYahtzeeLayout layout, IStandardScreen screen ) { _layout = layout; _screen = screen; Grid grid = new Grid(); 2.Times(x => GridHelper.AddLeftOverColumn(grid, 50)); grid.RowSpacing = 2; CrossPlatformBorderXF thisBorder; //no groupboxes. Grid otherGrid = new Grid(); otherGrid.BackgroundColor = Color.White; if (_screen.IsSmallest) { otherGrid.HorizontalOptions = LayoutOptions.Start; otherGrid.VerticalOptions = LayoutOptions.Start; } otherGrid.Margin = new Thickness(4, 4, 4, 4); otherGrid.RowSpacing = 0; otherGrid.ColumnSpacing = 0; GridHelper.AddControlToGrid(grid, otherGrid, 0, 0); //i think GridHelper.AddLeftOverColumn(otherGrid, 20); GridHelper.AddLeftOverColumn(otherGrid, 15); GridHelper.AddLeftOverColumn(otherGrid, 15); int pixelHeight = _layout.GetPixelHeight; 8.Times(y => GridHelper.AddPixelRow(otherGrid, pixelHeight)); Label thisLabel; var thisList = (from item in scoreContainer.RowList where item.IsTop == true && item.RowSection == EnumRow.Regular select item).ToCustomBasicList(); if (thisList.Count != 6) { throw new BasicBlankException("All yahtzee games must have 6 sections total, not " + thisList.Count); } int x = 0; foreach (var thisRow in thisList) { x += 1; AddBackroundLabel(otherGrid, thisRow, x); thisLabel = GetDescriptionText(thisRow.Description); thisLabel.InputTransparent = true; thisBorder = GetBorder(); thisBorder.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 0); GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 0); thisLabel = GetPossibleText(thisRow); thisLabel.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 1); thisBorder = GetBorder(); thisBorder.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 1); thisLabel = GetScoreText(thisRow); thisLabel.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 2); thisBorder = GetBorder(); thisBorder.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 2); RowClickerXF tempRow = new RowClickerXF(); GridHelper.AddControlToGrid(otherGrid, tempRow, x, 0); tempRow.BindingContext = thisRow; //i think. tempRow.SetName(nameof(IScoresheetAction.RowAsync)); tempRow.CommandParameter = thisRow; //GamePackageViewModelBinder.ManuelElements.Add(tempRow); Grid.SetColumnSpan(tempRow, 3); } RowInfo bonus = (from Items in scoreContainer.RowList where Items.IsTop == true && Items.RowSection == EnumRow.Bonus select Items).Single(); x += 1; thisLabel = GetDescriptionText(bonus.Description); GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 0); thisBorder = GetBorder(); GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 0); thisLabel = new Label(); thisLabel.BackgroundColor = Color.Aqua; GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 1); thisBorder = GetBorder(); GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 1); thisLabel = GetScoreText(bonus); GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 2); thisBorder = GetBorder(); GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 2); x += 1; //total score last thisLabel = GetFooterText("Upper Total"); GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 0); Grid.SetColumnSpan(thisLabel, 2); thisBorder = GetBorder(); GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 0); Grid.SetColumnSpan(thisBorder, 2); RowInfo topTotal = (from Items in scoreContainer.RowList where Items.IsTop == true && Items.RowSection == EnumRow.Totals select Items).Single(); thisLabel = GetScoreText(topTotal); GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 2); thisBorder = GetBorder(); GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 2); otherGrid = new Grid(); GridHelper.AddControlToGrid(grid, otherGrid, 0, 1); //i think otherGrid.BackgroundColor = Color.White; otherGrid.RowSpacing = 0; otherGrid.ColumnSpacing = 0; otherGrid.Margin = new Thickness(4, 4, 4, 4); if (_screen.IsSmallest) { otherGrid.HorizontalOptions = LayoutOptions.Start; otherGrid.VerticalOptions = LayoutOptions.Start; } GridHelper.AddLeftOverColumn(otherGrid, 20); GridHelper.AddLeftOverColumn(otherGrid, 15); GridHelper.AddLeftOverColumn(otherGrid, 15); thisList = (from Items in scoreContainer.RowList where Items.IsTop == false && Items.RowSection == EnumRow.Regular select Items).ToCustomBasicList(); int maxs = thisList.Count + 1; maxs.Times(x => GridHelper.AddPixelRow(otherGrid, pixelHeight)); x = 0; foreach (var thisRow in thisList) { RowClickerXF tempRow = new RowClickerXF(); AddBackroundLabel(otherGrid, thisRow, x); thisLabel = GetDescriptionText(thisRow.Description); thisLabel.InputTransparent = true; thisBorder = GetBorder(); thisBorder.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 0); GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 0); thisLabel = GetPossibleText(thisRow); thisLabel.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 1); thisBorder = GetBorder(); thisBorder.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 1); thisLabel = GetScoreText(thisRow); thisLabel.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 2); thisBorder = GetBorder(); thisBorder.InputTransparent = true; GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 2); GridHelper.AddControlToGrid(otherGrid, tempRow, x, 0); tempRow.BindingContext = thisRow; tempRow.SetName(nameof(IScoresheetAction.RowAsync)); tempRow.CommandParameter = thisRow; //GamePackageViewModelBinder.ManuelElements.Add(tempRow); Grid.SetColumnSpan(tempRow, 3); x += 1; //risking here. } RowInfo bottomTotal = (from Items in scoreContainer.RowList where Items.IsTop == false && Items.RowSection == EnumRow.Totals select Items).Single(); thisLabel = GetFooterText("Total Bottom Portion"); GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 0); Grid.SetColumnSpan(thisLabel, 2); thisBorder = GetBorder(); GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 0); Grid.SetColumnSpan(thisBorder, 2); thisLabel = GetScoreText(bottomTotal); GridHelper.AddControlToGrid(otherGrid, thisLabel, x, 2); thisBorder = GetBorder(); GridHelper.AddControlToGrid(otherGrid, thisBorder, x, 2); Content = grid; }