Example #1
0
        private void DeleteFromTodayExecute(RaisableObject energy)
        {
            BusyCount++;
            RunInBackground(() =>
            {
                switch (energyType)
                {
                    case EnergyType.Activity:
                        Diet.DeleteExersize((Exersize)energy);
                        break;
                    case EnergyType.Food:
                        Diet.DeleteEatenFood((Food)energy);
                        break;
                }

                InvokeInUIThread(() =>
                {
                    TodayItems.Remove(energy);
                    UpdateTotalSpent();
                    BusyCount--;
                });
            });
        }
Example #2
0
        private void NavigateToDetailsExecute(RaisableObject energy)
        {
            string navigationString = string.Empty;
            switch (searchType)
            {
                case EnergyType.Food:
                    navigationString = Constants.Pages.FoodDetails.AddPageParameter(Constants.NavigationParameters.FoodId, ((Food)energy).Id);
                    break;
                case EnergyType.Activity:
                    navigationString = Constants.Pages.ExersizeDetails.AddPageParameter(Constants.NavigationParameters.ActivityId, ((PhysicalActivity)energy).Id);
                    break;
            }

            if (fromPlan)
                navigationString = navigationString.AddPageParameter(Constants.NavigationParameters.FromPlan, true);

            if (!string.IsNullOrEmpty(navigationString))
            {
                Clear();
                NavigationProvider.NavigateAndRemoveBackEntry(navigationString);
            }
        }
Example #3
0
        public void AddEnergy(RaisableObject energy)
        {
            RaisableObject newEnergy = energy;
            switch (energyType)
            {
                case EnergyType.Food:
                    newEnergy = Diet.EatFood((Food)energy);
                    break;
                case EnergyType.Activity:
                    newEnergy = Diet.DoExersize((Exersize)energy);
                    break;
            }

            TodayItems.Add(newEnergy);
            UpdateTotalSpent();
            BusyCount--;
        }