private readonly ThreeLetterFunCardData _tempCard; //not sure. public ThreeLetterFunMainView(IEventAggregator aggregator, TestOptions test, ThreeLetterFunMainGameClass mainGame, ThreeLetterFunVMData model, GameBoard gameBoard ) { _aggregator = aggregator; _mainGame = mainGame; _model = model; _gameBoard = gameBoard; model.NewUI = this; _aggregator.Subscribe(this); StackLayout mainStack = new StackLayout(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer(nameof(ThreeLetterFunMainViewModel.RestoreScreen)); } _tempCard = new ThreeLetterFunCardData(); _tempCard.Visible = false; _currentCard = new CardGraphicsXF(); _currentCard.SendSize(ThreeLetterFunCardGraphicsCP.TagUsed, _tempCard); //i think. var winLabel = GetDefaultLabel(); winLabel.SetBinding(Label.TextProperty, new Binding(nameof(ThreeLetterFunMainViewModel.PlayerWon))); _score = new ScoreBoardXF(); _score.AddColumn("Cards Won", true, nameof(ThreeLetterFunPlayerItem.CardsWon)); StackLayout otherStack = new StackLayout(); otherStack.Orientation = StackOrientation.Horizontal; mainStack.Children.Add(_currentCard); mainStack.Children.Add(winLabel); mainStack.Children.Add(_gameBoard1); mainStack.Children.Add(_tileBoard1); var thisBut = GetGamingButton("Play", nameof(ThreeLetterFunMainViewModel.PlayAsync)); otherStack.Children.Add(thisBut); thisBut = GetGamingButton("Give Up", nameof(ThreeLetterFunMainViewModel.GiveUpAsync)); otherStack.Children.Add(thisBut); thisBut = GetGamingButton("Take Back", nameof(ThreeLetterFunMainViewModel.TakeBack)); otherStack.Children.Add(thisBut); mainStack.Children.Add(otherStack); mainStack.Children.Add(_score); if (restoreP != null) { mainStack.Children.Add(restoreP); //default add to grid but does not have to. } Content = mainStack; }
private readonly ThreeLetterFunCardData _tempCard; //not sure. public ThreeLetterFunMainView(IEventAggregator aggregator, TestOptions test, ThreeLetterFunMainGameClass mainGame, ThreeLetterFunVMData model, GameBoard gameBoard ) { _aggregator = aggregator; _mainGame = mainGame; _model = model; _gameBoard = gameBoard; model.NewUI = this; _aggregator.Subscribe(this); StackPanel mainStack = new StackPanel(); ParentSingleUIContainer?restoreP = null; if (test.SaveOption == EnumTestSaveCategory.RestoreOnly) { restoreP = new ParentSingleUIContainer() { Name = nameof(ThreeLetterFunMainViewModel.RestoreScreen) }; } _tempCard = new ThreeLetterFunCardData(); _tempCard.Visible = false; _currentCard = new CardGraphicsWPF(); _currentCard.SendSize(ThreeLetterFunCardGraphicsCP.TagUsed, _tempCard); //i think. var winLabel = GetDefaultLabel(); winLabel.SetBinding(TextBlock.TextProperty, new Binding(nameof(ThreeLetterFunMainViewModel.PlayerWon))); _score = new ScoreBoardWPF(); _score.AddColumn("Cards Won", true, nameof(ThreeLetterFunPlayerItem.CardsWon)); StackPanel otherStack = new StackPanel(); otherStack.Orientation = Orientation.Horizontal; mainStack.Children.Add(_currentCard); mainStack.Children.Add(winLabel); mainStack.Children.Add(_gameBoard1); mainStack.Children.Add(_tileBoard1); var thisBut = GetGamingButton("Play", nameof(ThreeLetterFunMainViewModel.PlayAsync)); otherStack.Children.Add(thisBut); thisBut = GetGamingButton("Give Up", nameof(ThreeLetterFunMainViewModel.GiveUpAsync)); otherStack.Children.Add(thisBut); thisBut = GetGamingButton("Take Back", nameof(ThreeLetterFunMainViewModel.TakeBack)); otherStack.Children.Add(thisBut); mainStack.Children.Add(otherStack); mainStack.Children.Add(_score); if (restoreP != null) { mainStack.Children.Add(restoreP); //default add to grid but does not have to. } GamePackageViewModelBinder.ManuelElements.Clear(); //often times i have to add manually. if (_mainGame.BasicData.MultiPlayer) { _score.LoadLists(_mainGame.PlayerList); //hopefully no need for the other controls since something else handles it now. } else { _score.Visibility = Visibility.Collapsed; } _tileBoard1.Init(_model); _gameBoard1.LoadList(_gameBoard, ThreeLetterFunCardGraphicsCP.TagUsed); Content = mainStack; }