private void LoadPlayers() { WebClient wc = new WebClient(); string playersString = wc.DownloadString("http://users.nik.uni-obuda.hu/siposm/db/players_v2.json"); JsonConvert .DeserializeObject <List <Profile> >(playersString) .ForEach(x => ProfileCollection.Insert(x, false)); }
private void Add() { NewPlayerWindow npw = new NewPlayerWindow(); Profile newProfile = new Profile(); npw.DataContext = newProfile; if (npw.ShowDialog() == true) { newProfile.Image = "https://randomuser.me/api/portraits/men/"; newProfile.Image += new Random().Next(0, 60).ToString() + ".jpg"; ProfileCollection.Insert(newProfile, false); } // alapból a lista végére rakunk (false) // itt most jól is jön ki mert a GUI-nál trükközni kéne, hogy a lista elejére való beszúráskor ott is jelenjen meg // eddig ez nem jött elő, mert list és obscoll esetén is a végére rak a .Add }