public DominosRegularMainView(IEventAggregator aggregator, TestOptions test, DominosRegularVMData model, IGamePackageResolver resolver ) { _aggregator = aggregator; _model = model; _resolver = resolver; _aggregator.Subscribe(this); StackPanel mainStack = new StackPanel(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer() { Name = nameof(DominosRegularMainViewModel.RestoreScreen) }; } _bone = new BoneYardWPF <SimpleDominoInfo, ts, DominosWPF <SimpleDominoInfo>, DominosBasicShuffler <SimpleDominoInfo> >(); _playerHandWPF = new BaseHandWPF <SimpleDominoInfo, ts, DominosWPF <SimpleDominoInfo> >(); _score = new ScoreBoardWPF(); _gameBoard1 = new GameBoardUI(); _bone.Height = 300; _bone.Width = 800; //can adjust as needed. mainStack.Children.Add(_bone); mainStack.Children.Add(_gameBoard1); mainStack.Children.Add(_playerHandWPF); SimpleLabelGrid firstInfo = new SimpleLabelGrid(); firstInfo.AddRow("Turn", nameof(DominosRegularMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(DominosRegularMainViewModel.Status)); mainStack.Children.Add(firstInfo.GetContent); _score.AddColumn("Total Score", true, nameof(DominosRegularPlayerItem.TotalScore)); _score.AddColumn("Dominos Left", true, nameof(DominosRegularPlayerItem.ObjectCount)); // if not important, can just comment mainStack.Children.Add(_score); Button endTurn = GetGamingButton("End Turn", nameof(DominosRegularMainViewModel.EndTurnAsync)); endTurn.HorizontalAlignment = HorizontalAlignment.Left; mainStack.Children.Add(endTurn); if (restoreP != null) { //todo: figure out where to place the restore ui if there is a restore option. mainStack.Children.Add(restoreP); //default add to grid but does not have to. } Content = mainStack; }
public DominosRegularMainView(IEventAggregator aggregator, TestOptions test, DominosRegularVMData model, IGamePackageResolver resolver ) { _aggregator = aggregator; _model = model; _resolver = resolver; _aggregator.Subscribe(this); StackLayout mainStack = new StackLayout(); _gameBoard1 = new GameBoardUI(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer(nameof(DominosRegularMainViewModel.RestoreScreen)); } _bone = new BoneYardXF <SimpleDominoInfo, ts, DominosXF <SimpleDominoInfo>, DominosBasicShuffler <SimpleDominoInfo> >(); _playerHandXF = new BaseHandXF <SimpleDominoInfo, ts, DominosXF <SimpleDominoInfo> >(); _score = new ScoreBoardXF(); if (ScreenUsed != EnumScreen.SmallPhone) { _bone.HeightRequest = 300; } else { _bone.HeightRequest = 90; } _bone.WidthRequest = 300; mainStack.Children.Add(_bone); SimpleLabelGridXF firstInfo = new SimpleLabelGridXF(); firstInfo.AddRow("Turn", nameof(DominosRegularMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(DominosRegularMainViewModel.Status)); mainStack.Children.Add(firstInfo.GetContent); _score.AddColumn("Total Score", true, nameof(DominosRegularPlayerItem.TotalScore)); _score.AddColumn("Dominos Left", true, nameof(DominosRegularPlayerItem.ObjectCount)); // if not important, can just comment mainStack.Children.Add(_score); Button endTurn = GetGamingButton("End Turn", nameof(DominosRegularMainViewModel.EndTurnAsync)); endTurn.HorizontalOptions = LayoutOptions.Start; StackLayout otherStack = new StackLayout(); otherStack.Orientation = StackOrientation.Horizontal; mainStack.Children.Add(otherStack); otherStack.Children.Add(_gameBoard1); mainStack.Children.Add(_playerHandXF); otherStack.Children.Add(firstInfo.GetContent); otherStack = new StackLayout(); otherStack.Orientation = StackOrientation.Horizontal; otherStack.Children.Add(_score); otherStack.Children.Add(endTurn); mainStack.Children.Add(otherStack); if (restoreP != null) { mainStack.Children.Add(restoreP); //default add to grid but does not have to. } Content = mainStack; }