private void listChanged(HraListChangedEventArgs e) { if (e.hraOperand != null) { Person target = (Person)e.hraOperand; FamilyHistoryRelativeRow fhrr = null; switch (e.hraListChangeType) { case HraListChangedEventArgs.HraListChangeType.ADD: Application.DoEvents(); fhrr = new FamilyHistoryRelativeRow(target); flowLayoutPanel1.Controls.Add(fhrr); break; case HraListChangedEventArgs.HraListChangeType.DELETE: Control toRemove = null; foreach (Control c in flowLayoutPanel1.Controls) { fhrr = (FamilyHistoryRelativeRow)c; if (fhrr.GetRelative().relativeID == target.relativeID) { toRemove = fhrr; break; } } if (toRemove != null) { flowLayoutPanel1.Controls.Remove(toRemove); } break; } foreach (Control c in flowLayoutPanel1.Controls) { fhrr = (FamilyHistoryRelativeRow)c; fhrr.SetDeleteButton(); } } }
private void FillControls() { if (Thread.CurrentThread.Name != "MainGUI") { FillControlsCallback rmc = new FillControlsCallback(FillControls); this.Invoke(rmc, null); } else { loadingCircle1.Active = true; loadingCircle1.Visible = true; foreach (Person p in proband.FHx.Relatives) { Application.DoEvents(); FamilyHistoryRelativeRow fhrr = new FamilyHistoryRelativeRow(p); flowLayoutPanel1.Controls.Add(fhrr); } loadingCircle1.Active = false; loadingCircle1.Visible = false; } }
private void listChanged(HraListChangedEventArgs e) { if (e.hraOperand != null) { Person target = (Person)e.hraOperand; FamilyHistoryRelativeRow fhrr = null; switch (e.hraListChangeType) { case HraListChangedEventArgs.HraListChangeType.ADD: Application.DoEvents(); fhrr = new FamilyHistoryRelativeRow(target); flowLayoutPanel1.Controls.Add(fhrr); break; case HraListChangedEventArgs.HraListChangeType.DELETE: Control toRemove = null; foreach(Control c in flowLayoutPanel1.Controls) { fhrr = (FamilyHistoryRelativeRow)c; if (fhrr.GetRelative().relativeID == target.relativeID) { toRemove = fhrr; break; } } if (toRemove != null) { flowLayoutPanel1.Controls.Remove(toRemove); } break; } foreach (Control c in flowLayoutPanel1.Controls) { fhrr = (FamilyHistoryRelativeRow)c; fhrr.SetDeleteButton(); } } }