private static void SaveOption(ValueBase valueBase, JsonSetting option) { if (option.Type == Setting.Checkbox) { Profile.Options[Profile.Options.FindIndex(o => o.UiD == option.UiD)].Value = valueBase.Cast<CheckBox>().CurrentValue.ToString(); } if (option.Type == Setting.Slider) { Profile.Options[Profile.Options.FindIndex(o => o.UiD == option.UiD)].Value = valueBase.Cast<Slider>().CurrentValue.ToString(); } if (option.Type == Setting.Combobox) { Profile.Options[Profile.Options.FindIndex(o => o.UiD == option.UiD)].Value = valueBase.Cast<ComboBox>().CurrentValue.ToString(); } }
private static void LoadOption(ValueBase valueBase, JsonSetting type) { if (type.Type == Setting.Checkbox) { valueBase.Cast<CheckBox>().CurrentValue = Convert.ToBoolean(type.Value); } if (type.Type == Setting.Slider) { valueBase.Cast<Slider>().CurrentValue = Convert.ToInt32(type.Value); } if (type.Type == Setting.Combobox) { valueBase.Cast<ComboBox>().CurrentValue = Convert.ToInt32(type.Value); } }