Example #1
0
 private void lbPlan_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (lbPlan.SelectedIndex < 0)
     {
         return;
     }
     // Grab the baseline data.
     BaselineDataForChart bdfc = new BaselineDataForChart();
     // Get the record.
     WeightRecord wr = bdfc.ElementAt(idarray[lbPlan.SelectedIndex]);
     // populate controls
     if (wr.week == 0)
     {
         txtWeightMsg.Text = "By your goal date on " + wr.date.ToShortDateString() + " your expected weight should be:";
         txtWeight.Text = wr.weight.ToString("0.0");
         txtDailyCals.Text = "";
         txtDailyCalsMsg.Text = "";
     }
     else
     {
         txtWeightMsg.Text = "Your expected weight at the start of week " + wr.week.ToString() + " on " + wr.date.ToShortDateString() + " should be:";
         txtWeight.Text = wr.weight.ToString("0.0");
         txtDailyCalsMsg.Text = "The maximum daily calories to meet the next week's goal weight will be:";
         txtDailyCals.Text = wr.dailycals.ToString("0");
     }
 }