public static void Load() { LastTab = Convert.ToInt16(GetSetting("LastTab", "0")); DatagridLastSelectedRow = Convert.ToInt16(GetSetting("DatagridLastSelectedRow", "1")); IsRandom = Convert.ToBoolean(GetSetting("IsRandom", "False")); Volume = Convert.ToInt32(GetSetting("Volume", "0")); LastAlbum = Convert.ToString(GetSetting("LastAlbum", "Alle")); LastCatalog = Convert.ToString(GetSetting("LastCatalog", "Alle")); LastGenre = Convert.ToString(GetSetting("LastGenre", "Alle")); LastArtist = Convert.ToString(GetSetting("LastArtist", "Alle")); FormTop = Convert.ToInt16(GetSetting("FormTop", "100")); FormLeft = Convert.ToInt16(GetSetting("FormLeft", "100")); FormWidth = Convert.ToInt16(GetSetting("FormWidth", "836")); FormHeight = Convert.ToInt16(GetSetting("FormHeight", "580")); FormSplitterLeft = Convert.ToInt16(GetSetting("FormSplitterLeft", "200")); FormState = Convert.ToString(GetSetting("FormState", "Normal")); RootImagePath = Convert.ToString(GetSetting("RootImagePath", "C:\\")); QueryList = DataGetSet.GetQueryList(); }
public static void Save() { var context = new MyJukeboxEntities(); foreach (KeyValuePair <string, object> item in Settings) { var update = context.tSettings.SingleOrDefault(n => n.Name == item.Key); update.Value = item.Value.ToString(); } context.SaveChanges(); var result = DataGetSet.TruncateTableQueries(); foreach (string query in QueryList) { context.tQueries.Add(new tQuery { Query = query }); } context.SaveChanges(); }