Exemple #1
0
 public void AddSingleObservation(ClincalObservation dx, bool isNew)
 {
     if (flowLayoutPanel.InvokeRequired)
     {
         AddSingleObservationCallback aoc = AddSingleObservation;
         object[] args = new object[1];
         args[0] = dx;
         args[1] = isNew;
         this.Invoke(aoc, args);
     }
     else
     {
         AddClinicalObservation(dx);
         CalculateOptimalDimensions();
         CheckForEmpty();
     }
 }
Exemple #2
0
        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();
            }
        }
Exemple #3
0
        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();
            }
        }