public static Image GetLogoImage(string currencyName) { if (string.IsNullOrEmpty(currencyName)) { return(null); } Image res = null; if (CurrencyLogoImage.TryGetValue(currencyName, out res)) { return(res); } try { res = LoadLogoImage(currencyName, false); if (CurrencyLogoImage.ContainsKey(currencyName)) { CurrencyLogoImage[currencyName] = res; } else { CurrencyLogoImage.Add(currencyName, res); } } catch (Exception) { return(null); } return(res); }
public static void BuildIconsDataBase(IEnumerable <string[]> list, bool allowDownload) { CurrencyLogo.Clear(); foreach (string[] str in list) { if (string.IsNullOrEmpty(str[0]) || string.IsNullOrEmpty(str[1]) || str[1] == "null") { continue; } if (!CurrencyLogo.ContainsKey(str[0])) { CurrencyLogo.Add(str[0], str[1]); } if (!CurrencyLogoImage.ContainsKey(str[0])) { Image res = LoadLogoImage(str[0], allowDownload); if (res != null && !CurrencyLogoImage.ContainsKey(str[0])) { CurrencyLogoImage.Add(str[0], res); } } } }