コード例 #1
0
        public MainBoardView(GameBoardCP boardcp)
        {
            CardBoardWPF <SimpleDominoInfo, ts, DominosWPF <SimpleDominoInfo> > boardui = new CardBoardWPF <SimpleDominoInfo, ts, DominosWPF <SimpleDominoInfo> >();

            Content = boardui;
            boardui.LoadList(boardcp, ts.TagUsed);
            //hopefully this simple this time.
        }
コード例 #2
0
        Task IUIView.TryActivateAsync()
        {
            PyramidSolitaireMainViewModel model = (PyramidSolitaireMainViewModel)DataContext;

            _deckGPile.Init(model.DeckPile, ts.TagUsed);
            _discardGPile.Init(model.Discard, ts.TagUsed);
            _currentCard.Init(model.CurrentPile, ts.TagUsed);
            _playerBoard.LoadList(model.PlayList1, ts.TagUsed);
            _triangle.Init(model.GameBoard1 !);
            return(Task.CompletedTask);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
 Task IHandleAsync <LoadEventModel> .HandleAsync(LoadEventModel message)
 {
     _beginXF.LoadList(_model.Beginnings1, ts.TagUsed);
     return(Task.CompletedTask);
 }