internal void RemoveObservation(ClincalObservation co) { if (flowLayoutPanel.InvokeRequired) { RemoveObservationCallback aoc = new RemoveObservationCallback(RemoveObservation); object[] args = new object[1]; args[0] = co; this.Invoke(aoc, args); } else { Control toBeRemoved = null; int maxWidth = 0; int totalHeight = 0; foreach (Control c in flowLayoutPanel.Controls) { PedigreeLegendRow plr = (PedigreeLegendRow)c; string plrDisplayName = plr.GetObservationisplayName(); string plrShortName = plr.GetObservationisplayShortName(); if (ClinicalObservationIsMatch(co, plrDisplayName, plrShortName)) { toBeRemoved = c; } } if (toBeRemoved != null) { flowLayoutPanel.Controls.Remove(toBeRemoved); } CalculateOptimalDimensions(); CheckForEmpty(); } }
internal void RemoveObservation(ClincalObservation co) { if (flowLayoutPanel.InvokeRequired) { RemoveObservationCallback aoc = new RemoveObservationCallback(RemoveObservation); object[] args = new object[1]; args[0] = co; this.Invoke(aoc, args); } else { Control toBeRemoved = null; bool noDups = true; int maxWidth = 0; int totalHeight = 0; 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) { if (noDups) { toBeRemoved = c; } else { noDups = false; } } else { if (plr.Width > maxWidth) { maxWidth = plr.Width; } totalHeight += plr.Height + legendPadding; } } if (toBeRemoved != null && noDups) { flowLayoutPanel.Controls.Remove(toBeRemoved); this.Height -= toBeRemoved.Height + legendPadding; if (maxWidth > 0 && this.Width > maxWidth + legendPadding) { this.Width = maxWidth + legendPadding; this.Height = totalHeight + legendPadding; } } this.Refresh(); CheckForEmpty(); } }
internal void RemoveObservation(ClincalObservation co) { if (flowLayoutPanel.InvokeRequired) { RemoveObservationCallback aoc = new RemoveObservationCallback(RemoveObservation); object[] args = new object[1]; args[0] = co; this.Invoke(aoc, args); } else { Control toBeRemoved = null; bool noDups = true; int maxWidth = 0; int totalHeight = 0; 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) { if (noDups) { toBeRemoved = c; } else { noDups = false; } } else { if (plr.Width > maxWidth) maxWidth = plr.Width; totalHeight += plr.Height + legendPadding; } } if (toBeRemoved != null && noDups) { flowLayoutPanel.Controls.Remove(toBeRemoved); this.Height -= toBeRemoved.Height + legendPadding; if (maxWidth > 0 && this.Width > maxWidth + legendPadding) { this.Width = maxWidth + legendPadding; this.Height = totalHeight + legendPadding; } } this.Refresh(); CheckForEmpty(); } }