public static BaseSettingModel Convert(SettingEntity entity) { BaseSettingModel model = null; if (entity.SettingValueType == SettingValueType.Int) model = new IntSettingModel(); else if (entity.SettingValueType == SettingValueType.Text) model = new TextSettingModel(); else if (entity.SettingValueType == SettingValueType.Select) model = new SelectSettingModel() { PossibleValues = entity.PossibleValues }; else if (entity.SettingValueType == SettingValueType.TrueOrFalse) model = new TrueOrFalseSettingModel() { OnContent = entity.OnContent, OffContent = entity.OffContent }; else return null; WriteBaseSettingModelValues(model, entity); return model; }
private async void InitializeSettingsAsync() { var model = (IntSettingModel) await _settingsRepository.GetSettingByKeyAsync(SettingKey.ConcurrentThreads); ConcurrentThreadCount = model.Value; _concurrentThreadsSettingModel = model; }