private ImageSource GetShellItemImageSource(IconSize size) { ImageSource img; ShellItem item = new ShellItem("shell:appsfolder\\" + AppUserModelId); item.AllowAsync = false; switch (size) { case IconSize.Small: img = item.SmallIcon; break; case IconSize.ExtraLarge: img = item.ExtraLargeIcon; break; case IconSize.Jumbo: img = item.JumboIcon; break; default: img = item.LargeIcon; break; } item.Dispose(); if (img != null) { return(img); } return(IconImageConverter.GetDefaultIcon()); }
public void RefreshListView(ShellItem parent) { mre.WaitOne(); this.Cursor = Cursors.WaitCursor; foreach (ListViewItem lvi in Items) { ShellItem item = (ShellItem)lvi.Tag; if (!item.IsFolder) { item.Dispose(); } } Items.Clear(); worker.RunWorkerAsync(parent); }