Beispiel #1
0
        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();
            }
        }
Beispiel #2
0
 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();
     }
 }
Beispiel #3
0
        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;
                }
            }
        }
Beispiel #4
0
        private bool ClinicalObservationDoesNotExist(ClincalObservation co)
        {
            bool add = true;

            foreach (Control c in flowLayoutPanel.Controls)
            {
                PedigreeLegendRow plr            = (PedigreeLegendRow)c;
                string            plrDisplayName = plr.GetObservationisplayName();
                string            plrShortName   = plr.GetObservationisplayShortName();
                if (ClinicalObservationIsMatch(co, plrDisplayName, plrShortName))
                {
                    add = false;
                    break;
                }
            }
            return(add);
        }
Beispiel #5
0
        private bool ItemFitsInRow(PedigreeLegendRow item, int widthUsedByCurrentRow, int usableWidth)
        {
            int itemWidth = item.Width + item.Padding.Left + item.Padding.Right + item.Margin.Left + item.Margin.Right;
            int realWidth = usableWidth -
                            (this.flowLayoutPanel.Margin.Right +
                             this.flowLayoutPanel.Margin.Left +
                             this.flowLayoutPanel.Padding.Left +
                             this.flowLayoutPanel.Padding.Right);

            if (realWidth - widthUsedByCurrentRow >= itemWidth)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        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();
                            }
                        }
                    }
                }
            }
        }
Beispiel #7
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();
            }
        }
Beispiel #8
0
        private bool ItemFitsInRow(PedigreeLegendRow item, int widthUsedByCurrentRow, int usableWidth)
        {
            int itemWidth = item.Width + item.Padding.Left + item.Padding.Right + item.Margin.Left + item.Margin.Right;
            int realWidth = usableWidth -
                            (this.flowLayoutPanel.Margin.Right +
                             this.flowLayoutPanel.Margin.Left +
                             this.flowLayoutPanel.Padding.Left +
                             this.flowLayoutPanel.Padding.Right);

            if (realWidth - widthUsedByCurrentRow >= itemWidth)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
Beispiel #9
0
 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;
         }
     }
 }
Beispiel #10
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();
            }
        }
Beispiel #11
0
        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();
                            }
                        }
                    }
                }
            }
        }