Exemplo n.º 1
0
 public void SetElementsSelection(DuhringLineControl elementCtrl, ModifierKey modKey)
 {
     if (modKey == ModifierKey.Ctrl)
     {
         elementCtrl.IsSelected = !elementCtrl.IsSelected;
         this.baseIndex         = this.GetIndexOfElement(elementCtrl);
     }
     else if (modKey == ModifierKey.Shift)
     {
         int currentIdx = this.GetIndexOfElement(elementCtrl);
         if (currentIdx >= 0 && this.baseIndex >= 0)
         {
             this.UnselectElements();
             int minIdx = System.Math.Min(currentIdx, this.baseIndex);
             int maxIdx = System.Math.Max(currentIdx, this.baseIndex);
             this.SetElementsSelection(minIdx, maxIdx);
         }
     }
     else
     {
         this.UnselectElements();
         elementCtrl.IsSelected = true;
         this.baseIndex         = this.GetIndexOfElement(elementCtrl);
     }
 }
Exemplo n.º 2
0
        public void DeleteSelectedElements()
        {
            IEnumerator e = this.GetSelectedIndexes().GetEnumerator();

            while (e.MoveNext())
            {
                DuhringLineControl element = this.GetElement((int)e.Current);
                this.DuhringLinesCache.RemoveDuhringLine(element.DuhringLine);
            }
        }
Exemplo n.º 3
0
        private void SetElementsSelection(int minIdx, int maxIdx)
        {
            DuhringLineControl element = null;

            for (int i = 0; i < this.panel.Controls.Count; i++)
            {
                if (i >= minIdx && i <= maxIdx)
                {
                    element            = this.panel.Controls[i] as DuhringLineControl;
                    element.IsSelected = true;
                }
            }
        }
Exemplo n.º 4
0
        private void UpdateTheUI(INumericFormat iNumericFormat, DuhringLinesCache duhringLinesCache)
        {
            this.panel.Controls.Clear();
            IEnumerator e = duhringLinesCache.DuhringLines.GetEnumerator();
            int         i = 0;

            while (e.MoveNext())
            {
                DuhringLine        duhringLine = (DuhringLine)e.Current;
                DuhringLineControl ctrl        = new DuhringLineControl(iNumericFormat, duhringLine, true);
                ctrl.Location = new Point(0, ctrl.Height * i++);
                this.panel.Controls.Add(ctrl);
            }
        }
Exemplo n.º 5
0
        private int GetIndexOfElement(DuhringLineControl elementCtrl)
        {
            int index = -1;

            for (int i = 0; i < this.panel.Controls.Count - 1; i++)
            {
                if ((this.panel.Controls[i] as DuhringLineControl).Equals(elementCtrl))
                {
                    index = i;
                    break;
                }
            }
            return(index);
        }