Exemplo n.º 1
0
        public void SaveRecipe(ICollection <Ingredient> _Ingredients, string _Title, string _Description)
        {
            //TODO Validate inputs

            int id;

            if (CurrentRecipe != null)
            {
                id = UpdateRecipe(_Ingredients, _Title, _Description);
            }
            else
            {
                id = CreateRecipe(_Ingredients, _Title, _Description);
            }

            view.FinishView(Result.Ok, new Intent().PutExtra(Constants.RECIPE_ID, id));
        }
Exemplo n.º 2
0
 public void onActivityResult(int requestCode, Result resultCode, Intent data)
 {
     if (requestCode == Constants.ENABLE_BLUETOOTH)
     {
         if (resultCode == Result.Canceled)
         {
             view.MakeDialog(Constants.TMP);
         }
         else if (resultCode == Result.Ok)
         {
             StartDiscoveryProcess();
         }
     }
     if (requestCode == Constants.CONN_OK)
     {
         if (resultCode == Result.Ok)
         {
             //view.MakeToast(data.GetStringExtra("msg"), ToastLength.Long);
             view.FinishView(Result.Ok, new Intent());
         }
     }
 }
 public void OnClickAddMealDay()
 {
     if (counter != mp.amountOfDays)
     {
         MealDay md = new MealDay();
         md.day     = counter;
         md.recipes = pickedRecipeDictionary.Values.ToList();
         mp.mealDays.Add(md);
         pickedRecipeDictionary.Clear();
         counter++;
         view.UpdateView();
     }
     else
     {
         if (mp.startDate != null)
         {
             MealDay md = new MealDay();
             md.day     = counter;
             md.recipes = pickedRecipeDictionary.Values.ToList();
             mp.mealDays.Add(md);
             Constants.Conn.Insert(mp);
             foreach (MealDay item in mp.mealDays)
             {
                 item.mealPlanId = mp.id;
                 Constants.Conn.Insert(item);
                 foreach (Recipe i in item.recipes)
                 {
                     MealDayRecipe mdr = new MealDayRecipe();
                     mdr.recipeId  = i.id;
                     mdr.mealDayId = item.id;
                     Constants.Conn.Insert(mdr);
                 }
             }
             view.FinishView(Result.Ok, new Intent());
         }
     }
     view.UpdateView();
 }
Exemplo n.º 4
0
 public void Add_Click()
 {
     view.FinishView(Result.Ok, new Intent());
 }