private readonly RackoUI _handWPF; //use this instead. public RackoMainView(IEventAggregator aggregator, TestOptions test, RackoVMData model, RackoGameContainer gameContainer ) { _aggregator = aggregator; _model = model; _gameContainer = gameContainer; _aggregator.Subscribe(this); _deckGPile = new BaseDeckWPF <RackoCardInformation, RackoGraphicsCP, CardGraphicsWPF>(); _discardGPile = new BasePileWPF <RackoCardInformation, RackoGraphicsCP, CardGraphicsWPF>(); _score = new ScoreBoardWPF(); _currentWPF = new BasePileWPF <RackoCardInformation, RackoGraphicsCP, CardGraphicsWPF>(); _handWPF = new RackoUI(); StackPanel mainStack = new StackPanel(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer() { Name = nameof(RackoMainViewModel.RestoreScreen) }; } Grid finalGrid = new Grid(); AddAutoRows(finalGrid, 1); AddAutoColumns(finalGrid, 2); mainStack.Children.Add(_deckGPile); mainStack.Children.Add(_discardGPile); // can reposition or not even have as well. mainStack.Children.Add(_currentWPF); var thisBut = GetGamingButton("Discard Current Card", nameof(RackoMainViewModel.DiscardCurrentAsync)); mainStack.Children.Add(thisBut); SimpleLabelGrid firstInfo = new SimpleLabelGrid(); firstInfo.AddRow("Turn", nameof(RackoMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(RackoMainViewModel.Status)); mainStack.Children.Add(firstInfo.GetContent); thisBut = GetGamingButton("Racko", nameof(RackoMainViewModel.RackoAsync)); mainStack.Children.Add(thisBut); AddControlToGrid(finalGrid, mainStack, 0, 0); _score.AddColumn("Score Round", true, nameof(RackoPlayerItem.ScoreRound)); _score.AddColumn("Score Game", true, nameof(RackoPlayerItem.TotalScore)); int x; for (x = 1; x <= 10; x++) { _score.AddColumn("Section" + x, false, "Value" + x, nameof(RackoPlayerItem.CanShowValues));// 2 bindings. } mainStack.Children.Add(_score); _handWPF = new RackoUI(); AddControlToGrid(finalGrid, _handWPF, 0, 1); // first column _deckGPile.Margin = new Thickness(5, 5, 5, 5); _discardGPile.Margin = new Thickness(5, 5, 5, 5); if (restoreP != null) { mainStack.Children.Add(restoreP); //default add to grid but does not have to. } Content = finalGrid; }
private readonly RackoUI _handWPF; //use this instead. public RackoMainView(IEventAggregator aggregator, TestOptions test, RackoVMData model, RackoGameContainer gameContainer ) { _aggregator = aggregator; _model = model; _aggregator.Subscribe(this); _gameContainer = gameContainer; _deckGPile = new BaseDeckXF <RackoCardInformation, RackoGraphicsCP, CardGraphicsXF>(); _discardGPile = new BasePileXF <RackoCardInformation, RackoGraphicsCP, CardGraphicsXF>(); _score = new ScoreBoardXF(); _currentWPF = new BasePileXF <RackoCardInformation, RackoGraphicsCP, CardGraphicsXF>(); _handWPF = new RackoUI(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer(nameof(RackoMainViewModel.RestoreScreen)); } Grid finalGrid = new Grid(); AddAutoRows(finalGrid, 2); AddLeftOverColumn(finalGrid, 1); AddAutoColumns(finalGrid, 1); _score.AddColumn("Score Round", true, nameof(RackoPlayerItem.ScoreRound)); _score.AddColumn("Score Game", true, nameof(RackoPlayerItem.TotalScore)); int x; for (x = 1; x <= 10; x++) { _score.AddColumn("Section" + x, false, "Value" + x, nameof(RackoPlayerItem.CanShowValues));// 2 bindings. } SimpleLabelGridXF firstInfo = new SimpleLabelGridXF(); firstInfo.AddRow("Turn", nameof(RackoMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(RackoMainViewModel.Status)); var stack = new StackLayout(); stack.Children.Add(_deckGPile); stack.Children.Add(_discardGPile); // can reposition or not even have as well. stack.Children.Add(_currentWPF); var thisBut = GetSmallerButton("Discard Current Card", nameof(RackoMainViewModel.DiscardCurrentAsync)); stack.Children.Add(thisBut); stack.Children.Add(firstInfo.GetContent); thisBut = GetSmallerButton("Racko", nameof(RackoMainViewModel.RackoAsync)); stack.Children.Add(thisBut); AddControlToGrid(finalGrid, stack, 0, 0); AddControlToGrid(finalGrid, _handWPF, 0, 1); // first column AddControlToGrid(finalGrid, _score, 1, 0); Grid.SetColumnSpan(_score, 2); _deckGPile.Margin = new Thickness(5, 5, 5, 5); _discardGPile.Margin = new Thickness(5, 5, 5, 5); if (restoreP != null) { stack.Children.Add(restoreP); //default add to grid but does not have to. } GamePackageViewModelBinder.ManuelElements.Clear(); //often times i have to add manually. RackoSaveInfo save = cons !.Resolve <RackoSaveInfo>(); //usually needs this part for multiplayer games. _score !.LoadLists(save.PlayerList); _discardGPile !.Init(_model.Pile1 !, ""); // may have to be here (well see) _discardGPile.StartListeningDiscardPile(); // its the main one. _deckGPile !.Init(_model.Deck1 !, ""); // try here. may have to do something else as well (?) _deckGPile.StartListeningMainDeck(); _currentWPF !.Init(_model.OtherPile !, ""); _currentWPF.StartAnimationListener("otherpile"); Content = finalGrid; }