示例#1
0
        private void loadMacroPlan()
        {
            usersPlan = new MacroPlan();

            try
            {
                var x  = new XmlSerializer(typeof(MacroPlan));
                var fs = new FileStream("macroPlan.xml", FileMode.Open);
                usersPlan = x.Deserialize(fs) as MacroPlan;
                fs.Close();

                textBox2.Text = usersPlan.calorieGoal.ToString();
                textBox3.Text = usersPlan.proteinGoal.ToString();
                textBox5.Text = usersPlan.carbGoal.ToString();
                textBox7.Text = usersPlan.fatGoal.ToString();
            }
            catch (Exception e)
            {
                //No macro plan found, must make one
                newMacros formForMacros = new newMacros(usersPlan, this);
                formForMacros.Show();
            }

            progressBar3.Maximum = usersPlan.calorieGoal;
            progressBar5.Maximum = usersPlan.proteinGoal;
            progressBar6.Maximum = usersPlan.carbGoal;
            progressBar7.Maximum = usersPlan.fatGoal;
        }
示例#2
0
        //Edit Macro Plan (menu button)
        private void macroPlanToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            newMacros formForMacros = new newMacros(usersPlan, this);

            formForMacros.Show();


            progressBar3.Maximum = usersPlan.calorieGoal;
            progressBar5.Maximum = usersPlan.proteinGoal;
            progressBar6.Maximum = usersPlan.carbGoal;
            progressBar7.Maximum = usersPlan.fatGoal;
        }