public static void Load(ref SAPbouiCOM.ComboBox comboBox, k.Lists.Bucket bucket, bool clear = true) { if (clear) { for (int i = comboBox.ValidValues.Count - 1; i >= 0; i--) { comboBox.ValidValues.Remove(i, SAPbouiCOM.BoSearchKey.psk_Index); } } foreach (var value in bucket) { comboBox.ValidValues.Add(value.ElementAt(0).Value, value.ElementAt(1).Value); } }
private static void LoadingGlobal() { if (bucket == null) { var configfile = k.Shell.File.Find(PATH, CONFIGGlobalFileName, System.IO.SearchOption.TopDirectoryOnly).FirstOrDefault(); #if DEBUG if (k.Shell.File.Find(PATH, CONFIGGlobalDevFileName, System.IO.SearchOption.TopDirectoryOnly).Length < 1) { System.IO.File.Copy(configfile.FullName, configfile.DirectoryName + "\\" + CONFIGGlobalDevFileName); configfile = new System.IO.FileInfo(configfile.DirectoryName + "\\" + CONFIGGlobalDevFileName); } #endif var json = System.IO.File.ReadAllText(configfile.FullName); var dic = JsonConvert.DeserializeObject <Dictionary <string, dynamic> >(json); var a = new object(); bucket = new k.Lists.Bucket(dic); k.Diagnostic.Debug(LOG, null, $"{configfile.Name} file loaded. {configfile.FullName}"); } }