Example #1
0
        public Goals(ClassLibrary1.Match2 currentMatch, ClassLibrary1.Team selectedTeam)
        {
            InitializeComponent();
            this.currentMatch = currentMatch;
            this.selectedTeam = selectedTeam;
            var goals = new List <Goal>();

            foreach (var footballer in selectedTeam.footballers)
            {
                footballer.goals.All(x =>
                {
                    x.footballer = footballer;
                    x.match      = currentMatch;
                    x.timeString = x.time.TimeOfDay.ToString();
                    return(true);
                });
                goals.AddRange(footballer.goals);
            }

            listBox.ItemsSource = goals;

            //HttpClient client = new HttpClient();
            //client.BaseAddress = new System.Uri(@"http://localhost:8080/");
            //HttpResponseMessage response = client.GetAsync($"Liga/goals/").Result;

            //if (response.IsSuccessStatusCode)
            //{
            //    var result = Newtonsoft.Json.JsonConvert.DeserializeObject<GoalsResponse>(response.Content.ReadAsStringAsync().Result);

            //    listBox.ItemsSource = result.goals.FindAll(i => i.teamName==selectedTeam.name);

            //}
            //else
            //    MessageBox.Show("Error - couldn't load any goals");
        }
Example #2
0
 private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     this.currentMatch = (ClassLibrary1.Match2)listBox.SelectedItem;
     if (currentMatch != null)
     {
         textTime.Text = currentMatch.date.TimeOfDay.ToString();
         textCity.Text = currentMatch.city.ToString();
         textHome.Text = currentMatch.hostTeam.name.ToString();
         textAway.Text = currentMatch.guestTeam.name.ToString();
     }
 }
Example #3
0
        public AddGoal(ClassLibrary1.Match2 selectedMatch, ClassLibrary1.Team selectedTeam)
        {
            InitializeComponent();
            this.currentMatch = selectedMatch;
            this.selectedTeam = selectedTeam;

            //HttpClient client = new HttpClient();
            //client.BaseAddress = new System.Uri(@"http://localhost:8080/");

            textBoxName.Text      = selectedTeam.name.ToString();
            comboBox1.ItemsSource = selectedTeam.footballers;

            /* //load teams
             * HttpResponseMessage response = client.GetAsync($"Liga/teams/").Result;
             * if (response.IsSuccessStatusCode)
             * {
             *   comboBox.ItemsSource = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClassLibrary1.Team>>(response.Content.ReadAsStringAsync().Result);
             *
             * }
             * else
             *   MessageBox.Show("Error - couldn't load any Teams");
             * //load footballers
             */
        }