Exemplo n.º 1
0
        private void BtnSearch_Click(object sender, RoutedEventArgs e)
        {
            NutritionixControl nutri = new NutritionixControl();

            Nutritionix.Item foo = nutri.LookupNutritionInfo(txtName.Text);

            PopulateFormFields(foo);

            //string toPrint = $"Product name: {foo.Name}, KCal: {foo.NutritionFact_Calories.ToString()}\n";
            //Debug.Print(toPrint);
        }
Exemplo n.º 2
0
 //metoda zapełnia pola formularza danymi pobranymi z API
 private void PopulateFormFields(Nutritionix.Item item)
 {
     txtName.Text     = item.Name;
     txtCalories.Text = Math.Floor((decimal)item.NutritionFact_Calories).ToString();
 }