protected override void OnCursorPressed(Point cursorPosition) { CurrentIndex++; if (CurrentIndex >= Values.Length) { CurrentIndex = 0; } var value = Values[CurrentIndex]; Text = DisplayFormat.FormatValue(value) ?? string.Empty; ValueChanged?.Invoke(this, value); }
public GuiEnumSwitchButton() { var values = Enum.GetValues(typeof(TEnum)); List <TEnum> v = new List <TEnum>(); foreach (var value in values) { v.Add((TEnum)value); } Values = v.ToArray(); Text = DisplayFormat?.FormatValue(Values[CurrentIndex]) ?? string.Empty; }