Esempio n. 1
0
        public void AddIngredient(string _Name, string _Amount, Ingredient.Unit _Unit)
        {
            Ingredient ing = new Ingredient(_Name, _Amount, _Unit);

            ingredientsList.Add(ing);
            view.UpdateView();
            view.ResetText();
        }
        public void AddShoppingListItem(string shopListItem)
        {
            ShoppingItem shopItem = new ShoppingItem(shopListItem);

            shoppingListList.Add(shopListItem);
            view.UpdateView();
            view.ResetText();

            Constants.Conn.Insert(shopItem);
        }
        public void PopulateRecipeList(int mealDayId)
        {
            var query = from mdr in Constants.Conn.Table <MealDayRecipe>() where mdr.mealDayId == mealDayId select mdr;

            foreach (MealDayRecipe mdr in query)
            {
                Recipe r = Constants.Conn.Get <Recipe>(mdr.recipeId);
                recipes.Add(r.Title, r);
            }
            view.UpdateView();
        }
        public void PopulateMealDaysFromStorage(int mealPlanId)
        {
            MealPlan mp    = Constants.Conn.Get <MealPlan>(mealPlanId);
            var      query = (from md in Constants.Conn.Table <MealDay>() where md.mealPlanId == mealPlanId select md).ToList();

            foreach (MealDay item in query)
            {
                mealDays.Add(item.day.ToString(), item);
                var recipeQuery = from mdr in Constants.Conn.Table <MealDayRecipe>() where mdr.mealDayId == item.id select mdr;
                foreach (MealDayRecipe i in recipeQuery)
                {
                    recipeFill.Add(Constants.Conn.Get <Recipe>(i.recipeId));
                }
                recipes.Add("" + item.day, recipeFill);
            }
            view.UpdateView();
        }
Esempio n. 5
0
            public override void OnReceive(Context context, Intent intent)
            {
                if (BluetoothAdapter.ActionDiscoveryStarted.Equals(intent.Action))
                {
                    //discovery started
                    presenter.IsDiscovering = true;
                    view.MakeToast("Discovery started", ToastLength.Short);
                }
                else if (BluetoothAdapter.ActionDiscoveryFinished.Equals(intent.Action))
                {
                    //discovery finished
                    if (presenter.IsDiscovering)
                    {
                        presenter.IsDiscovering = false;
                        view.MakeToast("Discovery finished", ToastLength.Short);
                    }
                }
                else if (BluetoothDevice.ActionFound.Equals(intent.Action))
                {
                    //first lets get the device
                    BluetoothDevice remoteDevice = (BluetoothDevice)intent.GetParcelableExtra(BluetoothDevice.ExtraDevice);

                    if (remoteDevice != null)
                    {
                        bool addressExists = false;

                        foreach (BluetoothDevice item in presenter.devices)
                        {
                            if (item.Address.Equals(remoteDevice.Address))
                            {
                                addressExists = true;
                            }
                        }

                        if (!addressExists)
                        {
                            presenter.devices.Add(remoteDevice);
                        }
                    }
                }
                view.UpdateView();
            }
Esempio n. 6
0
 public void onResume()
 {
     LoadRecipesFromStorage();
     view.UpdateView();
 }
 public void MealPlanAmountOfDays(int days)
 {
     mp.amountOfDays = days;
     view.UpdateView();
 }
 public void onCreate()
 {
     LoadMealPlanFromStorage();
     view.UpdateView();
 }
Esempio n. 9
0
 public void Clear_Click()
 {
     Bluetooth.ShareList.Clear();
     view.UpdateView();
 }
Esempio n. 10
0
 public void onCreate()
 {
     view.UpdateView();
 }