Example #1
0
        public TriangleSolitaireMainViewModel(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;
            DeckPile.SendEnableProcesses(this, () =>
            {
                if (_mainGame.GameGoing == false)
                {
                    return(false);
                }
                return(true);                                                      //if other logic is needed for deck, put here.
            });
            _mainGame = resolver.ReplaceObject <TriangleSolitaireMainGameClass>(); //hopefully this works.  means you have to really rethink.

            Pile1      = new PileObservable <SolitaireCard>(aggregator, commandContainer);
            Triangle1  = new TriangleBoard(this, CommandContainer, resolver);
            Pile1.Text = "Discard";
            Pile1.SendEnableProcesses(this, () => false);
        }
Example #2
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);
        }