public PlayerWithGames GetPlayerWithGames(int id) { PlayerWithGames playerWithGames = (from p in _repo.Query <Player>() where p.Id == id select new PlayerWithGames { Id = p.Id, UserName = p.UserName, PlayerName = p.PlayerName, Age = p.Age, HeightFt = p.HeightFt, HeightInch = p.HeightInch, Nationality = p.Nationality, HandPreference = p.HandPreference, IsSelected = p.IsSelected, Wins = p.Wins, Losses = p.Losses }).FirstOrDefault(); List <Game> games = (from gp in _repo.Query <GamePlayer>() where gp.PlayerId == id select gp.Game).ToList(); foreach (Game game in games) { GamesView gameData = gs.GetGame(game.Id); game.Player1 = gameData.Player1; game.Player2 = gameData.Player2; } playerWithGames.Games = games; return(playerWithGames); }
public GamesView GetGameWithLongestVolleyTime() { Player player; GamesView game = (from g in _repo.Query <Game>() orderby g.LongestVolleyTime descending select new GamesView { Id = g.Id, Player1Id = g.Player1.Id, Player2Id = g.Player2.Id, Player1Score = g.Player1Score, Player2Score = g.Player2Score, MaxVelocity = g.MaxVelocity, LongestVolleyHits = g.LongestVolleyHits, LongestVolleyTime = g.LongestVolleyTime, Player1 = g.Player1, Player2 = g.Player2, CreatedDate = g.CreatedDate }).FirstOrDefault(); player = (from p in _repo.Query <Player>() where p.Id == game.Player1Id select p).FirstOrDefault(); game.Player1 = player; player = (from p in _repo.Query <Player>() where p.Id == game.Player2Id select p).FirstOrDefault(); game.Player2 = player; return(game); }
private void GameView_Clicked(object sender, RoutedEventArgs e) { Download.SetCurrentValue(BackgroundProperty, new SolidColorBrush(Colors.Transparent)); Sounds.SetCurrentValue(BackgroundProperty, new SolidColorBrush(Colors.Transparent)); Game.SetCurrentValue(BackgroundProperty, new SolidColorBrush(Colors.Blue)); GamesView gamesView = new GamesView(); frame.NavigationService.Navigate(gamesView); }
private async void SfListView_OnSwipeEnded(object sender, SwipeEndedEventArgs e) { if (e.SwipeDirection == SwipeDirection.Right && e.SwipeOffset > 200) { var item = e.ItemData as Game; await _viewModel.HideGameAsync(item); GamesView.ResetSwipe(true); } }
private void HitLocationButton_Click(object sender, RoutedEventArgs e) { GamesView ChosenGame = (GamesView)PickGameList.SelectedItem; PickGame.Visibility = Visibility.Collapsed; chart0.Visibility = Visibility.Visible; HitLocationButton.Visibility = Visibility.Collapsed; PickNewGameButton.Visibility = Visibility.Visible; Game = gs.GetGame(ChosenGame.Id); PlotXYData(); }
public void Initialize() { this.container.RegisterType <INewsService, GamesNewsService>(new ContainerControlledLifetimeManager()); this.container.RegisterType <IGameService, GameService>(new ContainerControlledLifetimeManager()); this.container.RegisterType <IGameViewModelFactory, GameViewModelFactory>(new ContainerControlledLifetimeManager()); this.container.RegisterType <GamesViewModel>(); GamesView view = container.Resolve <GamesView>(); regionManager.AddToRegion(RegionNames.MainBody, view); regionManager.Regions[RegionNames.MainBody].Activate(view); }
private void Application_Startup(object sender, StartupEventArgs e) { MainViewModel = new GamesViewModel(); MainWindow = new LoginView(); MainWindow.ShowDialog(); if (MainViewModel.LoginViewModel.Player != null) { MainWindow = new GamesView(); MainWindow.ShowDialog(); } Shutdown(); }
protected override void Awake() { base.Awake(); // Init all tabs views this.gamesView = NavigationService.Get.ShowViewModel(typeof(GamesViewModel), root: this.transform, hidePreviousView: false).GetComponent <GamesView>(); this.appsView = NavigationService.Get.ShowViewModel(typeof(AppsViewModel), root: this.transform, hidePreviousView: false).GetComponent <AppsView>(); this.settingsView = NavigationService.Get.ShowViewModel(typeof(SettingsViewModel), root: this.transform, hidePreviousView: false).GetComponent <SettingsView>(); // Hide all tabs views this.gamesView.gameObject.SetActive(false); this.appsView.gameObject.SetActive(false); this.settingsView.gameObject.SetActive(false); }
public void DeleteGame(int id) { Player player1, player2; Game gameToBeDeleted = (from g in _repo.Query <Game>() where g.Id == id select g).FirstOrDefault(); GamesView gameData = GetGame(id); player1 = (from p in _repo.Query <Player>() where p.Id == gameData.Player1.Id select p).FirstOrDefault(); player2 = (from p in _repo.Query <Player>() where p.Id == gameData.Player2.Id select p).FirstOrDefault(); // adjust the player's Win/Losses: if (gameToBeDeleted.Player1Score > gameToBeDeleted.Player2Score) { player1.Wins--; player2.Losses--; } else { player2.Wins--; player1.Losses--; } _db.SaveChanges(); //delete the game: _repo.Delete(gameToBeDeleted); //delete the game's hit locations: List <HitLocation> gameHitLocs = _hitLocationSer.GetHitLocationsGame(id); if (gameHitLocs.Count != 0) { _hitLocationSer.DeleteHitLocationsGame(id); } }
public PlotHitLocations(Game _game, string _callPage) { CallPage = _callPage; InGame = _game; InitializeComponent(); if (InGame == null) { GetAllGames(); } else { HitLocationButton.Visibility = Visibility.Collapsed; PickGame.Visibility = Visibility.Collapsed; Game = gs.GetGame(InGame.Id); chart0.Visibility = Visibility.Visible; PlotXYData(); } }
public List <PlayerWithGames> ListPlayersWithGames() { List <PlayerWithGames> playersWtihGames = (from p in _repo.Query <Player>() select new PlayerWithGames { Id = p.Id, UserName = p.UserName, PlayerName = p.PlayerName, Age = p.Age, HeightFt = p.HeightFt, HeightInch = p.HeightInch, Nationality = p.Nationality, HandPreference = p.HandPreference, IsSelected = p.IsSelected, Wins = p.Wins, Losses = p.Losses }).ToList(); foreach (PlayerWithGames player in playersWtihGames) { List <Game> games = (from gp in _repo.Query <GamePlayer>() where gp.PlayerId == player.Id select gp.Game).ToList(); foreach (Game game in games) { GamesView gameData = gs.GetGame(game.Id); game.Player1 = gameData.Player1; game.Player2 = gameData.Player2; } player.Games = games; } return(playersWtihGames); }
public ActionResult <string> Get(int id) { GamesView game = _gameService.FindViewById(id); return(Ok(game)); }
private void btnTopJogos_Click(object sender, RoutedEventArgs e) { GamesView gamesView = new GamesView(authentication); gamesView.Show(); }