Exemplo n.º 1
0
        public StartViewModel(Game game)
        {
            this.currentGame = game;
            this.players = new ObservableCollection<PlayerViewModel>();

            foreach (Player p in this.currentGame.Players)
            {
                this.players.Add(new PlayerViewModel(p, null));
            }

            //this.collectionView = CollectionViewSource.GetDefaultView(this.players);
            //if (this.collectionView == null)
            //    throw new NullReferenceException("collectionView");
        }
Exemplo n.º 2
0
        public GameViewModel(Game game)
        {
            this.currentGame = game;
            this.players = new ObservableCollection<PlayerViewModel>();

            foreach (Player p in this.currentGame.Players)
            {
                this.players.Add(new PlayerViewModel(p, this));
            }

            this.collectionView = CollectionViewSource.GetDefaultView(this.players);
            if (this.collectionView == null)
                throw new NullReferenceException("collectionView");

            this.collectionView.CurrentChanged += new EventHandler(this.OnCollectionViewCurrentChanged);
        }
Exemplo n.º 3
0
        public MainWindow()
        {
            InitializeComponent();

            Game game = new Game();

            StartViewModel startViewModel = new StartViewModel(game);
            startViewModel.CurrentGame = game;
            this.DataContext = startViewModel;

            GameViewModel gameViewModel = new GameViewModel(game);
            this.GameView.DataContext = gameViewModel;
            this.CategoryView.DataContext = gameViewModel;

            Questions questions = new Questions();
            QuestionsViewModel questionsViewModel = new QuestionsViewModel(questions);
            this.QuestionsView.DataContext = questionsViewModel;
            this.QuestionsOpenView.DataContext = questionsViewModel;

               // this.DataContext = gameViewModel;
        }
Exemplo n.º 4
0
 private void ResetGame()
 {
     this.currentGame = new Game();
 }