private void listView_SelectedIndexChanged(object sender, EventArgs e) { if (listView.SelectedItems.Count == 0) { return; } TextureFormatProxy proxy = (TextureFormatProxy)listView.SelectedItems[0].Tag; try { FileTextureFormatProxy fproxy = proxy as FileTextureFormatProxy; string fullPath = null; if (fproxy != null) { fullPath = fproxy.FullPath; } using (Stream s = proxy.GetTextureStream()) OpenImportStream(s, fullPath, TextureFormatMode.Unspecified); } catch (Exception ex) { MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void FillListView(IEnumerable <string> files) { int i = 0; listView.Items.Clear(); foreach (string file in files) { TextureFormatProxy proxy = new FileTextureFormatProxy(file); ListViewItem item = new ListViewItem(new string[] { (i++).ToString(), proxy.Name, proxy.Size.ToString() }); item.Tag = proxy; listView.Items.Add(item); } }