示例#1
0
 private void cancel_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch("ProfilePage.xaml");
 }
示例#2
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            user.Info.Age = int.Parse(ageVal.Text);

            if (Female.IsChecked == true)
            {
                user.Info.Sex = BiologicalSex.Female;
            }
            else
            {
                user.Info.Sex = BiologicalSex.Male;
            }

            user.Info.Weight.Number = Double.Parse(weightVal.Text);

            if (weightUnit.SelectedItem.ToString() == WeightUnit.Pounds)
            {
                user.Info.Weight.Unit = WeightUnit.Pounds;
                user.Goal.Weight.Unit = WeightUnit.Pounds;
                user.Goal.WeightChange.PerWeekWeight.Unit = WeightUnit.Pounds;
            }
            else
            {
                user.Info.Weight.Unit = WeightUnit.Kilograms;
                user.Goal.Weight.Unit = WeightUnit.Kilograms;
                user.Goal.WeightChange.PerWeekWeight.Unit = WeightUnit.Kilograms;
            }


            user.Info.Height.Number = Int32.Parse(heightVal.Text);

            if (heightUnit.SelectedItem.ToString() == HeightUnit.Centimeters)
            {
                user.Info.Height.Unit = HeightUnit.Centimeters;
            }
            else
            {
                user.Info.Height.Unit = HeightUnit.Feet;
            }


            if (activityLvlVal.SelectedItem.ToString() == ActivityLevel.None)
            {
                user.Info.ActivityLevel = ActivityLevel.None;
            }
            else if (activityLvlVal.SelectedItem.ToString() == ActivityLevel.Light)
            {
                user.Info.ActivityLevel = ActivityLevel.Light;
            }
            else if (activityLvlVal.SelectedItem.ToString() == ActivityLevel.Medium)
            {
                user.Info.ActivityLevel = ActivityLevel.Medium;
            }
            else
            {
                user.Info.ActivityLevel = ActivityLevel.Heavy;
            }

            user.Goal.Steps = Int32.Parse(stepGoalVal.Text);

            if (goalCombo.SelectedIndex == 0)
            {
                user.Goal.Weight.Number = user.Info.Weight.Number;
                user.Goal.WeightChange.PerWeekWeight.Number = 0.0;
            }
            else
            {
                user.Goal.Weight.Number = Double.Parse(weightGoalVal.Text);
                double num = Double.Parse(weightChange.SelectedItem.ToString());

                if (goalCombo.SelectedIndex == 1)
                {
                    user.Goal.WeightChange.PerWeekWeight.Number = -num;
                }
                else if (goalCombo.SelectedIndex == 2)
                {
                    user.Goal.WeightChange.PerWeekWeight.Number = num;
                }

                user.Goal.CalorieGoal = user.CalcTDEE();
            }

            Weight newW = new Weight();

            newW.Number = user.Info.Weight.Number;
            newW.Unit   = user.Info.Weight.Unit;
            newW.Date   = DateTime.Today;
            user.WeightHistory[user.WeightHistory.Count - 1] = newW;

            //-----------------------------------//
            Switcher.Switch("ProfilePage.xaml");
        }
示例#3
0
 private void AddButton_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch("TrackerOptions.xaml");
 }
示例#4
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch("AddMealPage.xaml");
 }
示例#5
0
 private void ReportButton_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch("ActivityReportPage.xaml");
 }
示例#6
0
 private void updateProfileClick(object sender, RoutedEventArgs e)
 {
     Switcher.Switch("UpdateInfoPage.xaml");
 }
示例#7
0
 private void FinishButton_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch("AddActivityPage.xaml");
 }
示例#8
0
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch("ActivitiesPage.xaml");
 }
示例#9
0
 private void HomeButton_Click(object sender, RoutedEventArgs e)
 {
     Switcher.Switch("MainPage.xaml");
 }