Exemplo n.º 1
0
        private async void ProcessAll(string json)
        {
            fr      = Deserialize <FoodRoot>(json);
            fd      = fr.report.foods;
            Current = LoadActive(0);

            //Validate Refresh
            HttpClient hpClient = new HttpClient();
            string     results  = await hpClient.GetStringAsync(totals).ConfigureAwait(false);

            int    tstart = results.IndexOf("\"total\": ") + 8;
            int    tend   = results.IndexOf(",", tstart);
            string stotal = results.Substring(tstart, tend - tstart);
            int    total  = int.Parse(stotal);

            RefreshFoods = (total == fr.report.total);
        }
Exemplo n.º 2
0
        private void ProcessAll(string[] json)
        {
            Status("Processed string 1 of " + (json.Length) + ".");
            fr = Deserialize <FoodRoot>(json[0]);

            for (int j = 1; j < json.Length; j++)
            {
                Status("Processed string " + j + " of " + (json.Length - 1) + ".");
                FoodRoot tr = Deserialize <FoodRoot>(json[j]);
                fr.report.foods.AddRange(tr.report.foods);
            }

            fd      = fr.report.foods;
            Current = LoadActive(0);
            Status("Enter filter");
            Completed();
            WriteFile();
        }