public FileItemView(string fullFilename, FileIconType fileType) { InitializeComponent(); this.FullFilename = fullFilename; this.Filename = Path.GetFileName(fullFilename); UserControl icon = null; switch (fileType) { case FileIconType.Directory: icon = new DirectoryIcon(); break; case FileIconType.File: icon = new FileIcon(); break; } if (icon != null) { IconContext.Children.Add(icon); } RegisterEvents(); SetSelected(false); }
protected override void Dispose(bool disposing) { cancelSrc?.Dispose(); DirectoryIcon?.Dispose(); if (IconCache != null) { foreach (System.Drawing.Icon i in IconCache.Values) { i.Dispose(); } } if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }