public void LoadLists(CribbageVMData model) { _model = model; _thisGrid = new Grid(); _scoreList = _model.ScoreBoard1 !.ScoreList; _scoreList.CollectionChanged += ScoreList_CollectionChanged; AddAutoColumns(_thisGrid, 2); PopulateList(); Content = _thisGrid; }
public CribbageMainViewModel(CommandContainer commandContainer, CribbageMainGameClass mainGame, CribbageVMData viewModel, BasicData basicData, TestOptions test, IGamePackageResolver resolver ) : base(commandContainer, mainGame, viewModel, basicData, test, resolver) { _mainGame = mainGame; _model = viewModel; _model.Deck1.NeverAutoDisable = false; _model.Pile1.Text = "Start Card"; if (_mainGame.PlayerList.Count == 2) { _model.CribFrame.Maximum = 4; } else { _model.CribFrame.Maximum = 3; } _model.MainFrame.Maximum = 10; _model.PlayerHand1.Maximum = 6; }
public CribbageMainView(IEventAggregator aggregator, TestOptions test, CribbageVMData model ) { _aggregator = aggregator; _model = model; _aggregator.Subscribe(this); _deckGPile = new BaseDeckWPF <CribbageCard, ts, DeckOfCardsWPF <CribbageCard> >(); _discardGPile = new BasePileWPF <CribbageCard, ts, DeckOfCardsWPF <CribbageCard> >(); _score = new ScoreBoardWPF(); _playerHandWPF = new BaseHandWPF <CribbageCard, ts, DeckOfCardsWPF <CribbageCard> >(); _crib1 = new BaseHandWPF <CribbageCard, ts, DeckOfCardsWPF <CribbageCard> >(); _main1 = new BaseHandWPF <CribbageCard, ts, DeckOfCardsWPF <CribbageCard> >(); _otherScore = new ScoreUI(); _main1.Divider = 1.5; StackPanel mainStack = new StackPanel(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer() { Name = nameof(CribbageMainViewModel.RestoreScreen) }; } StackPanel otherStack = new StackPanel(); otherStack.Orientation = Orientation.Horizontal; otherStack.Children.Add(_deckGPile); otherStack.Children.Add(_discardGPile); // can reposition or not even have as well. otherStack.Children.Add(_main1); mainStack.Children.Add(otherStack); _score.AddColumn("Cards Left", false, nameof(CribbagePlayerItem.ObjectCount)); //very common. _score.AddColumn("Is Skunk Hole", false, nameof(CribbagePlayerItem.IsSkunk), useTrueFalse: true); _score.AddColumn("First Position", false, nameof(CribbagePlayerItem.FirstPosition)); _score.AddColumn("Second Position", false, nameof(CribbagePlayerItem.SecondPosition)); _score.AddColumn("Score Round", false, nameof(CribbagePlayerItem.ScoreRound)); _score.AddColumn("Total Score", false, nameof(CribbagePlayerItem.TotalScore)); SimpleLabelGrid firstInfo = new SimpleLabelGrid(); firstInfo.AddRow("Turn", nameof(CribbageMainViewModel.NormalTurn)); firstInfo.AddRow("Status", nameof(CribbageMainViewModel.Status)); firstInfo.AddRow("Dealer", nameof(CribbageMainViewModel.Dealer)); SimpleLabelGrid others = new SimpleLabelGrid(); others.AddRow("Count", nameof(CribbageMainViewModel.TotalCount)); mainStack.Children.Add(_playerHandWPF); otherStack = new StackPanel(); otherStack.Orientation = Orientation.Horizontal; mainStack.Children.Add(otherStack); var button = GetGamingButton("Continue", nameof(CribbageMainViewModel.ContinueAsync)); otherStack.Children.Add(button); button = GetGamingButton("To Crib", nameof(CribbageMainViewModel.CribAsync)); otherStack.Children.Add(button); button = GetGamingButton("Play", nameof(CribbageMainViewModel.PlayAsync)); otherStack.Children.Add(button); otherStack = new StackPanel(); otherStack.Orientation = Orientation.Horizontal; mainStack.Children.Add(otherStack); otherStack.Children.Add(firstInfo.GetContent); otherStack.Children.Add(_crib1); Grid finalGrid = new Grid(); AddPixelRow(finalGrid, 300); // hopefully this is enough AddLeftOverRow(finalGrid, 1); AddLeftOverColumn(finalGrid, 70); AddLeftOverColumn(finalGrid, 30); AddControlToGrid(finalGrid, mainStack, 0, 0); Grid.SetRowSpan(mainStack, 2); StackPanel finalStack = new StackPanel(); finalStack.Children.Add(others.GetContent); finalStack.Children.Add(_otherScore); AddControlToGrid(finalGrid, finalStack, 0, 1); AddControlToGrid(finalGrid, _score, 1, 1); _deckGPile.Margin = new Thickness(5, 5, 5, 5); _discardGPile.Margin = new Thickness(5, 5, 5, 5); 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 = finalGrid; }