private void teamChangedCallback(DependencyPropertyChangedEventArgs e) { if (team != null) { BitmapImage bmiLogoTeam = new BitmapImage(new Uri(team.UriLogo)); BitmapImage bmiCarTeam = new BitmapImage(new Uri(team.UriCar)); ObservableCollection <PilotDB> pilots = PilotDB.getPilotsTeam(team.Id); int qtatPilots = pilots.Count; txbIdTeam.Text = team.Pos.ToString(); txbPtsTeam.Text = team.Punctuation.ToString(); brdColorNameTeam.BorderBrush = colorEquip(team.TeamName); txbNameTeam.Text = team.TeamName; imgLogoTeam.Source = bmiLogoTeam; if (qtatPilots == 1) { uiPilotTeam1.pilot = pilots[0]; } else if (qtatPilots == 2) { uiPilotTeam1.pilot = pilots[0]; uiPilotTeam2.pilot = pilots[1]; } imgCarTeam.Source = bmiCarTeam; } }
private async void btnDelete_Click(object sender, RoutedEventArgs e) { if (lsvTeams.SelectedItem != null) { TeamsDB t = (TeamsDB)lsvTeams.SelectedItem; Boolean esborra = false; if (PilotDB.getPilotsTeam(t.Id).Count > 0) { ContentDialog deleteTeamDialog = new ContentDialog { Title = "Equip amb pilots", Content = "Vols esborrar l'equip i deixar als pilots sense equip?", PrimaryButtonText = "Esborrar", CloseButtonText = "Cancel·lar" }; ContentDialogResult result = await deleteTeamDialog.ShowAsync(); if (result == ContentDialogResult.Primary) { esborra = true; } } else { esborra = true; } if (esborra) { t.Delete(); crearTeamViewModel(null); updateListTeamAndPilotsUnasignedTeam(); EstatForm = Estat.NO_SELECCIONAT; } } }