예제 #1
0
        public override async void OnNavigatedTo(NavigationContext navigationContext)
        {
            base.OnNavigatedTo(navigationContext);
            var latestNetwork = await _accessService.GetLatestNetwork();

            _networkGeneration = latestNetwork.Generation;
            _blackPlayer       = EvolutionService.GetPlayer(latestNetwork.Network);
            ChangeTurn();
        }
예제 #2
0
 public DemoViewModel(IAccessService accessService, INotificationService notificationService)
 {
     _accessService       = accessService;
     _notificationService = notificationService;
     _timer = new Timer(3000)
     {
         AutoReset = true
     };
     _timer.Elapsed += (sender, args) => ChangeTurn();
     BindingOperations.EnableCollectionSynchronization(Board, new object());
     StartGameCommand = new DelegateCommand(async() =>
     {
         var whiteNetwork = await _accessService.GetByGeneration(WhiteGeneration);
         var blackNetwork = await _accessService.GetByGeneration(BlackGeneration);
         _whitePlayer     = EvolutionService.GetPlayer(whiteNetwork.Network);
         _blackPlayer     = EvolutionService.GetPlayer(blackNetwork.Network);
         Reset();
         _timer.Start();
     });
 }