Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
    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 = "";
    }
Ejemplo n.º 3
0
 public void RefreshKids()
 {
     if (Kids == null)
     {
         Kids = new ObservableCollection <string>();
     }
     Kids.Clear();
     foreach (var kid in UserProfileService.Instance.CurrentUserProfile.Kids)
     {
         Kids.Add(kid);
     }
 }