private void saveSettingItem(SettingItem item) { try { var dbItem = getSettingItem(item.Key); if(dbItem == null) { dbContext.SettingItems.Add(item); } else { dbItem.Value = item.Value; } dbContext.SaveChanges(); } catch (Exception r) { MessageBox.Show(r.InnerException.Message); } }
private void loadSettings() { viewSetting = getSettingItem("view.viewmode"); if (viewSetting == null) { viewSetting = new SettingItem { Key = "view.viewmode", Value="TV"}; } this.commandsList.Tag = viewSetting.Value; }