Example #1
0
        public async Task <IActionResult> Index()
        {
            await this.heroService.ValidateCurrentHeroLocation(WorkStatus.Battlefield);

            BattlefieldViewModel viewModel = await this.heroService.GetCurrentHeroViewModel <BattlefieldViewModel>();

            return(this.View(viewModel));
        }
 public MainViewModel()
 {
     Status           = "Ready";
     Battlefield      = new BattlefieldViewModel();
     StartGameCommand = new DelegateCommand(() => !IsGameRunning, async() => await StartGameAsync());
     StartDemoCommand = new DelegateCommand(() => !IsGameRunning, async() => await StartDemoAsync());
     ExitCommand      = new DelegateCommand(Exit);
 }
Example #3
0
 public GameArea(CMap map, CHeroBase hero, IGameServiceProvider provider) : this()
 {
     _provider       = provider;
     _viewModel      = new BattlefieldViewModel(map, hero, provider);
     DataContext     = _viewModel;
     Map.Source      = map;
     map.MapUpdated += OnMapUpdated;
 }
        private void BattlefieldViewControl_Loaded(object sender, RoutedEventArgs e)
        {
            BattlefieldViewModel battlefieldViewModelObject =
                new BattlefieldViewModel(BattlefieldViewControl.BattlefieldGrid);

            battlefieldViewModelObject.LoadBattleshipGame();

            BattlefieldViewControl.DataContext = battlefieldViewModelObject;
        }