/// <summary> /// Initializes a new instance of the <see cref="AudioSourceSettingKeyValue"/> class /// with the model, setting information and if it was saved. /// </summary> /// <param name="audioSource">The associated <see cref="IInternalAudioSource"/>.</param> /// <param name="source">The setting model.</param> /// <param name="settingAttribute">The <see cref="AudioSourceSettingAttribute"/>.</param> public AudioSourceSettingKeyValue(IInternalAudioSource audioSource, AudioSourceSetting source, AudioSourceSettingAttribute settingAttribute) { _settingAttribute = settingAttribute; _audioSource = audioSource; _originalSource = source; MapSelf(_originalSource, _model); // Model value was deserialized from string maybe so change to correct type source.Value = TypeConvertHelper.ConvertToType(source.Value, SettingType); }
/// <summary> /// Initializes a new instance of the <see cref="AudioSourceSettingVM"/> class /// with the model, setting information and if it was saved, /// </summary> /// <param name="audioSource">The associated <see cref="IInternalAudioSource"/>.</param> /// <param name="model">The <see cref="AudioSource"/>.</param> /// <param name="settingAttribute">The <see cref="AudioSourceSettingAttribute"/>.</param> /// <param name="saved">If this setting was saved.</param> public AudioSourceSettingVM(IInternalAudioSource audioSource, AudioSourceSetting model, AudioSourceSettingAttribute settingAttribute, bool saved = true) : base(model) { _settingAttribute = settingAttribute; _audioSource = audioSource; // Model value was deserialized from string maybe so change to correct type model.Value = TypeConvertHelper.ConvertToType(model.Value, SettingType); // If sensitive data and was not saved from before, don't automatically remember it if (Sensitive && !saved) { Remember = false; } }