public SettingViewModel() { _settingRepository = SettingRepository.SR; _selectedSetting = new SettingVo(); SettingList = new ObservableCollection <SettingVo>(_settingRepository.GetSettings()); ModifyCommand = new Command(ExecuteModifyMethod); InitalizeCommand = new Command(ExecuteInitalizeMethod); }
public void DeleteSetting(SettingVo setting) { MySqlDataAdapter adapter = new MySqlDataAdapter(_sql, _conn.Msc); DataTable table = _ds.Tables[0]; DataRow row = table.Select().Single(x => x["property"] as string == setting.Property); row.Delete(); Save(adapter); }
public List <SettingVo> GetSettings() { List <SettingVo> list = new List <SettingVo>(); foreach (DataRow row in _ds.Tables[0].Rows) { SettingVo s = new SettingVo(); s.Property = row["property"] as string; s.Value = row["value"] as string; list.Add(s); } return(list); }