/// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            bool dbExist = await CheckDbAsync("Details.db3");
            if (!dbExist)
            {
                await CreateDatabaseAsync();
            }

            name_diet.Text = TempDiets.NutSelected;
            name_category.Text = TempDiets.NutCategory;
            switch (name_category.Text)
            {
                case "Yellow food":

                    name_category.Foreground = new SolidColorBrush(Colors.LightYellow);
                    break;
                case "Green Food":

                    name_category.Foreground = new SolidColorBrush(Colors.LightGreen);
                    break;
                case "Red Food":

                    name_category.Foreground = new SolidColorBrush(Colors.Red);
                    break;


            }
           
            SQLiteAsyncConnection conn = new SQLiteAsyncConnection("Details.db3");
            var query = conn.Table<Details>().Where(x => x.Id.Equals(TempDiets.IDNutSelected));
             resultat = await query.FirstOrDefaultAsync();
            
            l.Add(new DetailsParts() { part = resultat.part1, val = resultat.val1+" Calories"  });
            l.Add(new DetailsParts() { part = resultat.part2, val = resultat.val2 + " Calories" });
            l.Add(new DetailsParts() { part = resultat.part3, val = resultat.val3 + " Calories" });
            l.Add(new DetailsParts() { part = resultat.part4, val = resultat.val4 + " Calories" });
           


           
            DietsList3.ItemsSource = l;
        }
        public async void Parse2()


        {


            Uri uri = new Uri("https://api.parse.com/1/classes/Details");
            Debug.WriteLine(uri);
            HttpClient cl = new HttpClient();

            HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, uri);
            request.Headers.Add("X-Parse-Application-Id", "7EjTEqzbb1zfFWz6BJArdZVKkPag6qUuKTCE7rz3");
            request.Headers.Add("X-Parse-REST-API-Key", "L3IEKFEazzTxzWVZim6oSVwCTvMPWwiI7IyQYnz3");

            HttpResponseMessage response = await cl.SendAsync(request);
            var data = await response.Content.ReadAsStringAsync();
            var parsedObject = JsonConvert.DeserializeObject<JObject>(data);

            JObject jsonObject = new JObject();
            jsonObject["results"] = parsedObject["results"];
            bool dbExist = await CheckDbAsync("Details.db3");
            if (!dbExist)
            {
                await CreateDatabaseAsync2();
            }
            else
            {

                conn = new SQLiteAsyncConnection("Details.db3");
            }
            //await DropTableAsync2();
         
            var listD = new List<Details>();
            foreach (var dataset in jsonObject["results"])
            {

                string Part1 = Convert.ToString(dataset["Part1"]);
                string Part2 = Convert.ToString(dataset["Part2"]);
                string Part3 = Convert.ToString(dataset["Part3"]);
                string Part4 = Convert.ToString(dataset["Part4"]);
                string Val1 = Convert.ToString(dataset["Val1"]);
                string Val2 = Convert.ToString(dataset["Val2"]);
                string Val3 = Convert.ToString(dataset["Val3"]);
                string Val4 = Convert.ToString(dataset["Val4"]);
                string id_DN = Convert.ToString(dataset["Id_DN"]);
            
                Details d = new Details();
                d.Id = id_DN;
                d.part1 = Part1;
                d.part2 = Part2;
                d.part3 = Part3;
                d.part4 = Part4;
                d.val1 = Val1;
                d.val2 = Val2;
                d.val3 = Val3;
                d.val4 = Val4;





                listD.Add(d);
                //Debug.WriteLine(Part1);
            }
           // await DropTableAsync2();
            await conn.InsertAllAsync(listD);
            int i = 0;
            foreach (Details d in listD)
            {

                Debug.WriteLine("Compteur Details =" + i);
                i++;
                Debug.WriteLine(d.part1);

            }
        }