Exemplo n.º 1
0
        public SettingsViewModel(ClockSettings settings)
        {
            _gameTime = settings.GameTime;
            _delayTime = settings.DelayTime;
            switch (settings.Delay)
            {
                case ClockSettings.DelayType.None:
                    _selectedDelayType = DelayTypes[0];
                    _delayEntryEnabled = false;
                    break;
                case ClockSettings.DelayType.Fischer:
                    _selectedDelayType = DelayTypes[1];
                    _delayEntryEnabled = true;
                    break;
                case ClockSettings.DelayType.Bronstein:
                    _selectedDelayType = DelayTypes[2];
                    _delayEntryEnabled = true;
                    break;
                case ClockSettings.DelayType.Normal:
                    _selectedDelayType = DelayTypes[3];
                    _delayEntryEnabled = true;
                    break;
            }

            _hoursPickerItems = new List<int>();
            for (int i = 0; i <= 10; i++) _hoursPickerItems.Add(i);

            _minutesPickerItems = new List<int>();
            _secondsPickerItems = new List<int>();
            for (int i = 0; i <= 59; i++)
            {
                _minutesPickerItems.Add(i);
                _secondsPickerItems.Add(i);
            }
        }
Exemplo n.º 2
0
        public static ChessClock CreateClock(ClockSettings settings)
        {
            switch (settings.Delay)
            {
            default:
            case ClockSettings.DelayType.None:
                return(new NoDelayChessClock(settings.GameTime));

            case ClockSettings.DelayType.Fischer:
                return(new FischerDelayChessClock(settings.GameTime, settings.DelayTime));

            case ClockSettings.DelayType.Bronstein:
                return(new BronsteinDelayChessClock(settings.GameTime, settings.DelayTime));

            case ClockSettings.DelayType.Normal:
                return(new NormalDelayChessClock(settings.GameTime, settings.DelayTime));
            }
        }