public void SetCurrentMode(SelectMode value) { if (CurrentMode == value) { return; } if (_currentFieldView != null) { switch (CurrentMode) { case SelectMode.smNone: _currentFieldView.SetSelected(false); _currentFieldView.SetMultiSelected(false); break; case SelectMode.smSingle: _currentFieldView.SetSelected(false); break; case SelectMode.smMultiple: _currentFieldView.SetMultiSelected(false); break; } } _currentMode = value; if (_currentFieldView != null) { switch (CurrentMode) { case SelectMode.smNone: _currentFieldView = null; break; case SelectMode.smSingle: SelectCurrentField(_currentFieldView); break; case SelectMode.smMultiple: _currentFieldView.SetSelected(true); break; } if (_currentFieldView != null) { _currentFieldView.Refresh(); } } }
public void SelectCurrentField(TekFieldView newfield) { if (newfield == null) { CurrentMode = SelectMode.smNone; } else { if (CurrentMode == SelectMode.smNone) { _currentMode = SelectMode.smSingle; } switch (CurrentMode) { case SelectMode.smSingle: if (_currentFieldView != null && _currentFieldView.IsSelected) { _currentFieldView.SetSelected(false); } newfield.SetSelected(!newfield.IsSelected); foreach (TekFieldView field in MultiselectFieldView) { field.SetMultiSelected(false); } MultiselectFieldView.Clear(); break; case SelectMode.smMultiple: newfield.SetMultiSelected(!newfield.IsMultiSelected); if (!MultiselectFieldView.Contains(newfield)) { MultiselectFieldView.Add(newfield); } else { MultiselectFieldView.Remove(newfield); } break; } _currentFieldView = newfield; } }