private void AddClinicalObservation(ClincalObservation co) { var add = ClinicalObservationDoesNotExist(co); if (add) { if (string.IsNullOrEmpty(co.disease) == false) { PedigreeLegendRow plr = new PedigreeLegendRow(); plr.SetObservation(co); flowLayoutPanel.Controls.Add(plr); this.Visible = true; } } }
public void AddObservations(ClinicalObservationList dxList) { if (flowLayoutPanel.InvokeRequired) { AddObservationsCallback aoc = new AddObservationsCallback(AddObservations); object[] args = new object[1]; args[0] = dxList; this.Invoke(aoc, args); } else { lock (dxList) { foreach (ClincalObservation co in dxList) { bool add = true; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow plr = (PedigreeLegendRow)c; string plrDisplayName = plr.GetObservationisplayName(); string plrShortName = plr.GetObservationisplayShortName(); if (string.Compare(co.ClinicalObservation_diseaseDisplayName, plrDisplayName, true) == 0 && string.Compare(co.ClinicalObservation_diseaseShortName, plrShortName) == 0) { add = false; break; } } if (add) { if (string.IsNullOrEmpty(co.disease) == false) { PedigreeLegendRow plr = new PedigreeLegendRow(); plr.SetObservation(co); flowLayoutPanel.Controls.Add(plr); this.Height = flowLayoutPanel.Location.Y + plr.Location.Y + plr.Height + legendPadding; this.Refresh(); } } } } } }
public void AddSingleObservation(ClincalObservation dx, bool isNew) { if (flowLayoutPanel.InvokeRequired) { AddSingleObservationCallback aoc = new AddSingleObservationCallback(AddSingleObservation); object[] args = new object[1]; args[0] = dx; args[1] = isNew; this.Invoke(aoc, args); } else { bool add = true; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow plr = (PedigreeLegendRow)c; string plrDisplayName = plr.GetObservationisplayName(); string plrShortName = plr.GetObservationisplayShortName(); if (string.Compare(dx.ClinicalObservation_diseaseDisplayName, plrDisplayName, true) == 0 && string.Compare(dx.ClinicalObservation_diseaseShortName, plrShortName) == 0) { add = false; } } if (add) { if (string.IsNullOrEmpty(dx.disease) == false) { PedigreeLegendRow plr = new PedigreeLegendRow(); plr.SetObservation(dx); flowLayoutPanel.Controls.Add(plr); this.Height = flowLayoutPanel.Location.Y + plr.Location.Y + plr.Height + legendPadding; if (isNew) { if (flowLayoutPanel.Controls.Count == 1) { this.Location = new Point(SessionManager.Instance.MetaData.CurrentUserDefaultPedigreePrefs.GUIPreference_LegendX, SessionManager.Instance.MetaData.CurrentUserDefaultPedigreePrefs.GUIPreference_LegendY); } int maxWidth = 0; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow row = (PedigreeLegendRow)c; if (row.Width > maxWidth) { maxWidth = row.Width; } } if (maxWidth + legendPadding > this.Width) { this.Width = maxWidth + legendPadding; } } this.Refresh(); } } CheckForEmpty(); } }
public void AddSingleObservation(ClincalObservation dx, bool isNew) { if (flowLayoutPanel.InvokeRequired) { AddSingleObservationCallback aoc = new AddSingleObservationCallback(AddSingleObservation); object[] args = new object[1]; args[0] = dx; args[1] = isNew; this.Invoke(aoc, args); } else { bool add = true; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow plr = (PedigreeLegendRow)c; string plrDisplayName = plr.GetObservationisplayName(); string plrShortName = plr.GetObservationisplayShortName(); if (string.Compare(dx.ClinicalObservation_diseaseDisplayName, plrDisplayName, true) == 0 && string.Compare(dx.ClinicalObservation_diseaseShortName, plrShortName) == 0) { add = false; } } if (add) { if (string.IsNullOrEmpty(dx.disease) == false) { PedigreeLegendRow plr = new PedigreeLegendRow(); plr.SetObservation(dx); flowLayoutPanel.Controls.Add(plr); this.Height = flowLayoutPanel.Location.Y + plr.Location.Y + plr.Height + legendPadding; if (isNew) { if (flowLayoutPanel.Controls.Count == 1) { this.Location = new Point(SessionManager.Instance.MetaData.CurrentUserDefaultPedigreePrefs.GUIPreference_LegendX, SessionManager.Instance.MetaData.CurrentUserDefaultPedigreePrefs.GUIPreference_LegendY); } int maxWidth = 0; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow row = (PedigreeLegendRow)c; if (row.Width > maxWidth) maxWidth = row.Width; } if (maxWidth + legendPadding > this.Width) this.Width = maxWidth + legendPadding; } this.Refresh(); } } CheckForEmpty(); } }