Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace lab4
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- List<NBATeam> timovi = Data.GetTeams();
- lstTeams.ItemsSource = timovi;
- lstTeams.SelectedIndex = 0;
- }
- private void lstTeams_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- filterPlayers();
- }
- private void filterPlayers() {
- NBATeam tim = (NBATeam) lstTeams.SelectedItem;
- List<String> igraci = new List<string>();
- if (tim != null)
- {
- foreach (NBAPlayer igrac in tim.Players)
- {
- if (Rd1.IsChecked == true)
- {
- igraci.Add(igrac.Name + " - " + igrac.PointsPerGame);
- }
- else
- {
- igraci.Add(igrac.Name + " - " + igrac.MinutesPlayed);
- }
- }
- lstPlayers.ItemsSource = igraci;
- lstPlayers.Background = tim.TeamColor;
- }
- }
- private void Rd2_Checked(object sender, RoutedEventArgs e)
- {
- filterPlayers();
- }
- private void Rd1_Checked(object sender, RoutedEventArgs e)
- {
- filterPlayers();
- }
- }
- public class ImageConverter : IValueConverter {
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- string imgPath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), (String)value);
- return new BitmapImage(new Uri(imgPath));
- }
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement