private void DownloadDonasiList(object sender, DownloadStringCompletedEventArgs e)
 {
     try
     {
         JObject jresult = JObject.Parse(e.Result);
         JArray JItem = JArray.Parse(jresult.SelectToken("item").ToString());
         foreach (JObject item in JItem)
         {
             ModelDonasi modelDonasi = new ModelDonasi();
             modelDonasi.id_anak_asuh = item.SelectToken("id_anak_asuh").ToString();
             modelDonasi.nama_anak_asuh = item.SelectToken("nama_anak_asuh").ToString();
             modelDonasi.foto_anak = URL.BASE + "modul/mod_AnakAsuh/photo/" + item.SelectToken("foto_anak").ToString();
             modelDonasi.jenjang_pendidikan = "Jenjang " + item.SelectToken("jenjang_pendidikan").ToString();
             modelDonasi.status_anak = "Status " + item.SelectToken("status_anak").ToString();
             collectionAnakAsuh.Add(modelDonasi);
             //ModelKeranjang modelKeranjang = new ModelKeranjang();
             //modelKeranjang.id = item.SelectToken("id_anak_asuh").ToString();
             //modelKeranjang.nama_anak = item.SelectToken("nama_anak_asuh").ToString();
             
             //collectionAnakAsuh.Add(modelKeranjang);
         }
     }
     catch
     {
         konek = false;
     }
 }
        private void LoadUrl()
        {
            try
            {

                RestRequest request = new RestRequest(URL.BASE3 + "APIv2/fosterchildren/fosterchildren.php", Method.POST);

                request.AddHeader("content-type", "multipart/form-data");
                request.AddParameter("id_donors", Navigation.navIdDonors);
                request.AddParameter("token", Navigation.token);
                request.AddParameter("id_fosterchildren", Navigation.navIdAnak);

                //calling server with restClient
                RestClient restClient = new RestClient();
                restClient.ExecuteAsync(request, (response) =>
                {
                    ShellToast toast = new ShellToast();
                    toast.Title = "Status Upload";
                    JObject jRoot = JObject.Parse(response.Content);
                    String result = jRoot.SelectToken("result").ToString();
                    //String id_donasi = jRoot.SelectToken("id_donation").ToString();
                    //String photo_child = jRoot.SelectToken("photo").ToString();
                    JArray JItem = JArray.Parse(jRoot.SelectToken("item").ToString());
                    foreach (JObject item in JItem)
                    {
                        ModelDonasi modelDonasi = new ModelDonasi();
                        modelDonasi.id_fosterchildren = item.SelectToken("id_fosterchildren").ToString();
                        modelDonasi.name = item.SelectToken("name").ToString();
                        modelDonasi.photo = URL.BASE3 + "modul/mod_AnakAsuh/photo/" + item.SelectToken("photo").ToString();
                        modelDonasi.study_level = item.SelectToken("study_level").ToString();
                        modelDonasi.children_status = item.SelectToken("children_status").ToString();
                        //Navigation.idDonation = id_donasi;
                        //Navigation.navPhotoChild = photo_child;
                        collectionDonasi.Add(modelDonasi);
                    }
                    if (response.StatusCode == System.Net.HttpStatusCode.OK)
                    {
                        if (result.Equals("success"))
                        {
                            NewHomepage homepage = new NewHomepage();
                            homepage.LoadingBar.Visibility = Visibility.Collapsed;
                        }
                        else
                        {

                            MessageBox.Show("Data not found");
                        }
                    }
                    else
                    {
                        //error ocured during upload

                        toast.Content = "Your posting failed. Please check the Internet connection.";
                        toast.Show();
                        //progressBar1.Visibility = System.Windows.Visibility.Visible;

                    }
                });
            }
            catch (Exception ec)
            {
                MessageBox.Show("Failed to display, the Internet connection is unstable.");
            }
            finally
            {
                //ProgressVisibiliy = Visibility.Visible;
            }
        }