public void LoadImages(bool loadCustomIcons) { ImgList.Clear(); keyFileDict.Clear(); ImgList.Add("default", defImage); foreach (KeyValuePair <string, Pixbuf> image in defaultImages) { ImgList.Add(image.Key, image.Value); } if (Directory.Exists("icons") && loadCustomIcons) { foreach (string f in Directory.GetFiles("icons")) { using (Pixbuf img = new Pixbuf(f)) { string imgKey = Path.GetFileNameWithoutExtension(f); if (ImgList.ContainsKey(imgKey)) { ImgList.Remove(imgKey); } keyFileDict[imgKey] = f; ImgList.Add(imgKey, img); } } } }
/// <summary> /// Empty and release resource of the list /// </summary> public void Clear() { // release the resources of the img list ClearCache(); ImgList.Clear(); }