public override async void OnNavigatedTo(NavigationContext navigationContext) { base.OnNavigatedTo(navigationContext); var latestNetwork = await _accessService.GetLatestNetwork(); _networkGeneration = latestNetwork.Generation; _blackPlayer = EvolutionService.GetPlayer(latestNetwork.Network); ChangeTurn(); }
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(); }); }