async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { Kids.Clear(); WebRequest request = WebRequest.Create("http//:kidstracking.azurewebsites.net/api/parent/GetAllKids"); request.Headers.Add(HttpRequestHeader.Authorization, Xamarin.Essentials.Preferences.Get("token", "")); WebResponse response = request.GetResponse(); System.IO.Stream stream = response.GetResponseStream(); byte[] data = new byte[(int)stream.Length]; stream.Read(data, 0, (int)stream.Length); string Json = System.Text.Encoding.UTF8.GetString(data); var items = Newtonsoft.Json.JsonConvert.DeserializeObject <System.Collections.Generic.IEnumerable <Kid> >(Json); foreach (var item in items) { Kids.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public void DeleteFamily() { //gonna remove it since IsEmptyFamily() doesnt talk abt HomeKey //ask abt the amt of family memenrs //Home = ""; State = H.None; Kids.Clear(); _father = ""; _mother = ""; }
public void RefreshKids() { if (Kids == null) { Kids = new ObservableCollection <string>(); } Kids.Clear(); foreach (var kid in UserProfileService.Instance.CurrentUserProfile.Kids) { Kids.Add(kid); } }