Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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;
        }