public void SelectDrawBox(DrawBox selected) { if (selected != null) { if (!DrawBoxList.Contains(selected)) { Debug.AddExceptionInClass(this.GetType(), "SelectDrawBox", "Selected drawbox is not part of this container"); return; } SelectedDrawBox = selected; selected.Activated = true; } else { SelectedDrawBox = null; } foreach (DrawBox box in DrawBoxList) { if (selected != box) { box.Activated = false; } } if (oldSelected != SelectedDrawBox && HasSwitched != null) { HasSwitched(this, SelectedDrawBox); } }
public void SelectNext() { int index = DrawBoxList.IndexOf(SelectedDrawBox); index++; if (index >= DrawBoxList.Count) { index = 0; } SelectedDrawBox = DrawBoxList[index]; if (oldSelected != SelectedDrawBox && HasSwitched != null) { HasSwitched(this, SelectedDrawBox); } }