Пример #1
0
        public static void createAllSampleData()
        {
            createDummyPersons();
            createSampleFoodList();
            createSampleWaterList();

            FoodCalculation.calculateFood();
            WaterCalculation.calculateWater();
            PeopleCalculation.calculateNumberOfPeople();
        }
Пример #2
0
        private void b_acceptDeletePerson_OnClick(object sender, RoutedEventArgs e)
        {
            App._vmData.personList.Remove(((((sender as Button).Parent as StackPanel).Parent as StackPanel).Parent as Card).DataContext as Person);

            PeopleCalculation.calculateNumberOfPeople();
            WaterCalculation.calculateWater();
            FoodCalculation.calculateFood();

            //Just to force an updaten on VM
            App._vmData.totalCalorieConsumption = "";
        }
Пример #3
0
        private void b_addPerson_Click(object sender, RoutedEventArgs e)
        {
            var p = new Person {
                firstName = "New Person"
            };

            App._vmData.personList.Add(p);

            PeopleCalculation.calculateNumberOfPeople();
            WaterCalculation.calculateWater();
            FoodCalculation.calculateFood();

            //Just to force an updaten on VM
            App._vmData.totalCalorieConsumption = "";
        }
Пример #4
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            //Load Saved Data from User (ViewModel)
            Load.LoadFromJson();

            //Language
            if (_vmData.cultureInfo != null)
            {
                Thread.CurrentThread.CurrentUICulture = _vmData.cultureInfo;
            }
            else
            {
                _vmData.cultureInfo = Thread.CurrentThread.CurrentUICulture;
            }

            //Initial Calculations based on stored values
            FoodCalculation.calculateFood();
            WaterCalculation.calculateWater();
            PeopleCalculation.calculateNumberOfPeople();

            //DEBUG: Don't send email every time.
            //RequestEmail.postEmailRequestToEmailAPI(ExpirationCalculation.calculateExpiringFoodItem());
            //ExpirationCalculation.startExpirationEmailChecker();
        }