private void LoadBands(string id) { JArray arrayJSON = GET_Request("https://amu.tkg.ovh/json/offer/_getOfferBands.php?id=", id); for (int i = 0; i < arrayJSON.Count; i++) { JObject item = (JObject)arrayJSON[i]; JArray arrayJSONBand = GET_Request("https://amu.tkg.ovh/json/band/_getBand.php?id=", (string)item.GetValue("band_id")); JObject itemBand = (JObject)arrayJSONBand[0]; BandGage band = new BandGage { Band = new Band { Name = (string)itemBand.GetValue("name"), Logo_Path = (string)itemBand.GetValue("logo_path"), Website_Url = (string)itemBand.GetValue("website_url"), Notes = (string)itemBand.GetValue("notes"), Leader_Username = (string)itemBand.GetValue("leader_username"), Record_Date = (DateTime)itemBand.GetValue("record_date"), ID = itemBand.Value <int?>("ID") ?? -1, Leader_ID = itemBand.Value <int?>("leader_id") ?? -1 }, Gage = (string)item.GetValue("price") }; lstbxBands.Items.Add(band); } }
private void LstbxBandSelectionChanged(object sender, SelectionChangedEventArgs e) { if (!(lstbxBand.SelectedItem == null)) { BandGage bandGage = ((BandGage)lstbxBand.SelectedItem); LoadUser(bandGage.Band.Leader_ID); lblWebsite.Content = bandGage.Band.Website_Url; lblBesetzung.Content = "Besetzung: " + GetBandMembersCount(bandGage.Band.ID); txtbxGage.Text = bandGage.Gage ?? ""; } }
private void BandGageSpeichern(object sender, RoutedEventArgs e) { BandGage selectedBand = ((BandGage)lstbxBand.SelectedItem); for (int i = 0; i < bandGageList.Count; i++) { if (bandGageList[i].Band.ID.Equals(selectedBand.Band.ID)) { bandGageList[i].Gage = txtbxGage.Text; lstbxBand.Items.Clear(); foreach (BandGage item in bandGageList) { lstbxBand.Items.Add(item); } txtbxGage.Text = ""; } } }