Пример #1
0
        Task IHandleAsync <LoadEventModel> .HandleAsync(LoadEventModel message)
        {
            CribbagePatienceMainViewModel model = (CribbagePatienceMainViewModel)BindingContext;
            var hand1 = model.GetScoreHand(EnumHandCategory.Hand1);
            var hand2 = model.GetScoreHand(EnumHandCategory.Hand2);
            var crib  = model.GetScoreHand(EnumHandCategory.Crib);

            _hand1Score.Init(hand1);
            _hand2Score.Init(hand2);
            _cribScore.Init(crib);
            _cribHand.LoadList(model.TempCrib, ts.TagUsed);
            _yourHand.LoadList(model.Hand1, ts.TagUsed);
            _score1.Init(model);
            return(Task.CompletedTask);
        }
        public void Init(CribbagePatienceMainViewModel thisMod)
        {
            _thisMod   = thisMod;
            Text       = "Score Summary";
            _scoreList = thisMod.Scores !.ScoreList;
            _scoreList.CollectionChanged += CollectionChanged;
            Grid parentGrid = new Grid();

            _thisGrid = new Grid();
            AddPixelColumn(_thisGrid, 150);
            AddAutoColumns(_thisGrid, 1);
            SetUpMarginsOnParentControl(_thisGrid);
            parentGrid.Children.Add(ThisDraw);
            parentGrid.Children.Add(_thisGrid);
            HorizontalOptions = LayoutOptions.Fill; //i think
            PopulateList();
            Content = parentGrid;
        }
 public Task NewGameAsync(CribbagePatienceMainViewModel model)
 {
     _model    = model;
     GameGoing = true;
     if (_rummys != null)
     {
         throw new BasicBlankException("Rummy should not have been created since its fresh every new game");
     }
     _rummys            = new RummyProcesses <EnumSuitList, EnumColorList, CribbageCard>();
     _rummys.HasSecond  = false;
     _rummys.HasWild    = false;
     _rummys.LowNumber  = 1;
     _rummys.HighNumber = 13;
     _rummys.NeedMatch  = false;
     _rummys.UseAll     = true;
     PopulateLists();
     return(base.NewGameAsync(_model.DeckPile));
 }
        public void Init(CribbagePatienceMainViewModel thisMod)
        {
            _thisMod   = thisMod;
            Text       = "Score Summary";
            _scoreList = thisMod.Scores !.ScoreList;
            _scoreList.CollectionChanged += CollectionChanged;
            Grid parentGrid = new Grid();

            _thisGrid = new Grid();
            AddPixelColumn(_thisGrid, 150);
            AddAutoColumns(_thisGrid, 1);
            var thisRect = ThisFrame.GetControlArea();

            SetUpMarginsOnParentControl(_thisGrid, thisRect);
            parentGrid.Children.Add(ThisDraw);
            parentGrid.Children.Add(_thisGrid);
            HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
            PopulateList();
            Content = parentGrid;
        }
        Task IUIView.TryActivateAsync()
        {
            CribbagePatienceMainViewModel model = (CribbagePatienceMainViewModel)DataContext;

            _deckGPile.Init(model.DeckPile, ts.TagUsed);
            if (model.StartPile == null)
            {
                throw new BasicBlankException("Start card was never set.  Rethink");
            }
            _startCard.Init(model.StartPile, ts.TagUsed);

            var(row, column) = model.GetRowColumn(EnumHandCategory.Hand1);
            AddControlToGrid(_grid, _hand1Score, row, column);
            var hand2D = model.GetRowColumn(EnumHandCategory.Hand2);

            AddControlToGrid(_grid, _hand2Score, hand2D.row, hand2D.column);
            var cribD = model.GetRowColumn(EnumHandCategory.Crib);

            AddControlToGrid(_grid, _cribScore, cribD.row, cribD.column);
            return(Task.CompletedTask);
        }