Пример #1
0
        public PokerMainViewModel(IEventAggregator aggregator,
                                  CommandContainer commandContainer,
                                  IGamePackageResolver resolver
                                  )
        {
            GlobalClass.PokerList.Clear(); //can't be brand new  that could cause the connection to break too.
            _aggregator      = aggregator; //this time no new game.  just close out when you are done now.
            Round            = 1;
            CommandContainer = commandContainer;
            CommandContainer.ExecutingChanged += CommandContainer_ExecutingChanged; //hopefully no problem (?)
            DeckPile = resolver.ReplaceObject <DeckObservablePile <PokerCardInfo> >();
            DeckPile.DeckClickedAsync += DeckPile_DeckClickedAsync;
            DeckPile.NeverAutoDisable  = true;
            DeckPile.SendEnableProcesses(this, () =>
            {
                return(!IsRoundOver);
            });

            Bet1 = new NumberPicker(commandContainer, resolver);
            Bet1.SendEnableProcesses(this, () =>
            {
                return(!BetPlaced);
            });
            Bet1.LoadNumberList(new CustomBasicList <int>()
            {
                5, 10, 25
            });
            Bet1.SelectNumberValue(5); //something else has to set to large (?)
            Bet1.ChangedNumberValueAsync += Bet1_ChangedNumberValueAsync;

            _mainGame = resolver.ReplaceObject <PokerMainGameClass>(); //hopefully this works.  means you have to really rethink.
        }
Пример #2
0
        public HeapSolitaireMainViewModel(IEventAggregator aggregator,
                                          CommandContainer commandContainer,
                                          IGamePackageResolver resolver
                                          )
        {
            _aggregator      = aggregator;
            CommandContainer = commandContainer;
            CommandContainer.ExecutingChanged += CommandContainer_ExecutingChanged; //hopefully no problem (?)
            DeckPile = resolver.ReplaceObject <DeckObservablePile <HeapSolitaireCardInfo> >();
            DeckPile.DeckClickedAsync += DeckPile_DeckClickedAsync;
            DeckPile.NeverAutoDisable  = true;
            _aggregator.Subscribe(this);
            DeckPile.SendEnableProcesses(this, () =>
            {
                return(false);
            });
            _mainGame = resolver.ReplaceObject <HeapSolitaireMainGameClass>(); //hopefully this works.  means you have to really rethink.

            Waste1 = new WastePiles(CommandContainer, _aggregator, _mainGame);
            Waste1.PileClickedAsync += Waste1_PileClickedAsync;
            Main1 = new MainPiles(CommandContainer, _aggregator, _mainGame);
            Main1.PileClickedAsync += Main1_PileClickedAsync;
        }
Пример #3
0
        public PyramidSolitaireMainViewModel(IEventAggregator aggregator,
                                             CommandContainer commandContainer,
                                             IGamePackageResolver resolver
                                             )
        {
            _aggregator      = aggregator;
            CommandContainer = commandContainer;
            CommandContainer.ExecutingChanged += CommandContainer_ExecutingChanged; //hopefully no problem (?)
            DeckPile = resolver.ReplaceObject <DeckObservablePile <SolitaireCard> >();
            DeckPile.DeckClickedAsync += DeckPile_DeckClickedAsync;
            DeckPile.NeverAutoDisable  = true;
            aggregator.Subscribe(this);
            DeckPile.SendEnableProcesses(this, () =>
            {
                if (_mainGame.GameGoing == false)
                {
                    return(false);
                }
                return(true);                                                     //if other logic is needed for deck, put here.
            });
            _mainGame = resolver.ReplaceObject <PyramidSolitaireMainGameClass>(); //hopefully this works.  means you have to really rethink.

            CurrentPile = new PileObservable <SolitaireCard>(_aggregator, commandContainer);
            CurrentPile.SendEnableProcesses(this, () => CurrentPile.PileEmpty() == false);
            CurrentPile.Text              = "Current";
            CurrentPile.CurrentOnly       = true;
            CurrentPile.PileClickedAsync += CurrentPile_PileClickedAsync;
            Discard = new PileObservable <SolitaireCard>(_aggregator, CommandContainer);
            Discard.SendEnableProcesses(this, () => Discard.PileEmpty() == false);
            Discard.Text              = "Discard";
            Discard.PileClickedAsync += Discard_PileClickedAsync;
            PlayList1 = new PlayList(CommandContainer, aggregator);
            PlayList1.SendEnableProcesses(this, () => PlayList1.HasChosenCards());
            PlayList1.Visible = true;
            GameBoard1        = new TriangleBoard(this, CommandContainer, resolver, _mainGame);
        }