コード例 #1
0
        public editFood(Primary prim)
        {
            this.prim = prim;

            InitializeComponent();

            foreach (Food food in prim.bank)
            {
                comboBox1.Items.Add(food);
            }
        }
コード例 #2
0
ファイル: Day.cs プロジェクト: sco11/MacroTracker
        public void removeMeal(int indexToRemove, Form primaryForm)
        {
            Primary primForm = (Primary)primaryForm;

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

            todaysFood.RemoveAt(indexToRemove);
            todaysFoodQuantities.RemoveAt(indexToRemove);


            //calculateCalories() -= todaysFood[indexToRemove].calories * (int)todaysFoodQuantities[indexToRemove];
            if (calculateCalories() <= primForm.progressBar3.Maximum)
            {
                primForm.progressBar3.Value = calculateCalories();
            }


            //calculateProtein() -= todaysFood[indexToRemove].protein * (int)todaysFoodQuantities[indexToRemove];
            if (calculateProtein() <= primForm.progressBar5.Maximum)
            {
                primForm.progressBar5.Value = calculateProtein();
            }


            //calculateCarbs() -= todaysFood[indexToRemove].carbs * (int)todaysFoodQuantities[indexToRemove];
            if (calculateCarbs() <= primForm.progressBar6.Maximum)
            {
                primForm.progressBar6.Value = calculateCarbs();
            }


            //calculateFats() -= todaysFood[indexToRemove].fats * (int)todaysFoodQuantities[indexToRemove];
            if (calculateFats() <= primForm.progressBar7.Maximum)
            {
                primForm.progressBar7.Value = calculateFats();
            }
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            user = new MacroPlan((int)numericUpDown1.Value, (int)numericUpDown2.Value, (int)numericUpDown3.Value, (int)numericUpDown4.Value);

            Primary f1 = (Primary)primForm;

            f1.textBox2.Text = user.calorieGoal.ToString();
            f1.textBox3.Text = user.proteinGoal.ToString();
            f1.textBox5.Text = user.carbGoal.ToString();
            f1.textBox7.Text = user.fatGoal.ToString();

            //Now save to xml file
            var x = new XmlSerializer(typeof(MacroPlan));
            //var fs = new FileStream("macroPlan.xml", FileMode.Open);
            var fs = new FileStream("macroPlan.xml", FileMode.Create);

            x.Serialize(fs, user);
            fs.Close();


            this.Close();
        }
コード例 #4
0
        public newEstimate(Primary x)
        {
            this.x = x;

            InitializeComponent();
        }