Ejemplo n.º 1
0
        private void comboIsolation_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Nothing needs to be done if comboIsolation's value is the same
            if (Equals(comboIsolation.SelectedItem, _lastWindowType))
            {
                return;
            }
            _lastWindowType = comboIsolation.SelectedItem;

            bool isIsolation = Equals(comboIsolation.SelectedItem, WindowType.MEASUREMENT);
            int  row         = 0;

            foreach (EditIsolationWindow window in _gridViewDriver.Items)
            {
                double startMargin = window.StartMargin ?? 0;
                double endMargin   = startMargin;

                if (window.Start != null)
                {
                    double newStart;
                    if (isIsolation)
                    {
                        newStart = (double)window.Start - startMargin;
                    }
                    else
                    {
                        newStart = (double)window.Start + startMargin;
                    }
                    _gridViewDriver.SetCellValue(COLUMN_START, row, newStart);
                }
                if (window.End != null)
                {
                    double newEnd;
                    if (isIsolation)
                    {
                        newEnd = (double)window.End + endMargin;
                    }
                    else
                    {
                        newEnd = (double)window.End - endMargin;
                    }
                    _gridViewDriver.SetCellValue(COLUMN_END, row, newEnd);
                }
                row++;
            }
        }