Esempio n. 1
0
        private void ApplicationStartup(object sender, StartupEventArgs e)
        {
            GameChooserViewModel gameChooserViewModel = new GameChooserViewModel();
            Window gameChooser = new GameChooser(gameChooserViewModel)
            {
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            gameChooser.ShowDialog();

            if (gameChooserViewModel.SelectedGame == null)
            {
                return;
            }

            var game = Activator.CreateInstance(gameChooserViewModel.SelectedGame.Class);

            if (!(game is GenericGameManager gameManager))
            {
                return;
            }

            MainWindow = new MainWindow(new MainViewModel(gameManager));
            MainWindow.Show();
        }
Esempio n. 2
0
 public GameChooser(GameChooserViewModel viewModel)
 {
     InitializeComponent();
     DataContext = ViewModel = viewModel;
 }