Exemple #1
0
        public GameHostWindow()
        {
            InitializeComponent();

            myGameProvider.LoadGames();

            IDictionary <string, IGame> myGames = myGameProvider.GetGames();

            if (myGames.Any())
            {
                GameControllerFactory.SetViewModel(myGameViewModel);

                myGameViewModel.Games = myGames;

                this.DataContext = myGameViewModel;
            }
        }
        public GameHostWindow()
        {
            InitializeComponent();

            myGameProvider.LoadGames();

            IDictionary <string, IGame> myGames = myGameProvider.GetGames();

            if (myGames.Any())
            {
                myGameHost = GameControllerFactory.CreateGameController(GameMode.SinglePlayer);
            }

            IGameViewModel viewModel = myGameHost.GetGameViewModel();

            viewModel.Games = myGames;

            viewModel.GameControllerCommand = new GameControllerCommand(myGameHost);

            viewModel.StartGameCommand = new StartGameCommand(myGameHost);

            this.DataContext = viewModel;
        }