private void lb_gnomes_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lb_gnomes.SelectedItem == null || supressChange)
            {
                return;
            }
            if (currentDisplayedGnome != null)
            {
                panel_gnome.Controls.Remove(currentDisplayedGnome);
            }
            var dw = (lb_gnomes.SelectedItem as DataWrapper);

            currentDisplayedGnome = new Frame_SelectTreatment_Gnome(dw.StateRecord, dw.TreatRecord);
            panel_gnome.Controls.Add(currentDisplayedGnome);
            currentDisplayedGnome.Dock = DockStyle.Fill;
            currentDisplayedGnome.TreatmentPlanChanged += new EventHandler <EventArgs <Patient> >((planChangeSender, planChangeArgs) =>
            {
                dw.TreatRecord = planChangeArgs.Argument;
                var changes    = dw.TreatRecord.Effects.Count() + dw.TreatRecord.Parts.Count();
                var maxChanges = dw.StateRecord.Effects.Count() + dw.StateRecord.Parts.Count();
                dw.Text        = changes >= maxChanges ? ("TREATALL: " + dw.StateRecord.ToString()) : (changes <= 0 ? dw.StateRecord.ToString() : "TREAT: " + dw.StateRecord.ToString());
                supressChange  = true;
                lb_gnomes.Items[lb_gnomes.SelectedIndex] = dw;
                supressChange = false;
            });
        }
 public limbCheckboxWrapper(Frame_SelectTreatment_Gnome gnome, Button btn, Limb limb)
 {
     Gnome        = gnome;
     Button       = btn;
     Limb         = limb;
     initial_text = btn.Text;
     Update();
     btn.Click += new EventHandler((sender, args) =>
     {
         Gnome.OnTreatmentPlanChanged(Gnome.treatRecord.Get_ToggleLimb(Limb));
         Update();
         Gnome.updateLimbCheckbox();
     });
 }
 public effectCheckboxWrapper(Frame_SelectTreatment_Gnome frame_SelectTreatment_Gnome, System.Windows.Forms.Button btn, HealthStatusAilment effect)
 {
     this.Gnome  = frame_SelectTreatment_Gnome;
     this.Button = btn;
     this.Effect = effect;
     Update();
     btn.Width  = 130;
     btn.Click += new EventHandler((sender, args) =>
     {
         Gnome.OnTreatmentPlanChanged(Gnome.treatRecord.Get_ToggleEffect(effect));
         Update();
         Gnome.updateEffectCheckbox();
     });
 }