private void ListView_DragDrop(object sender, DragEventArgs e) { ListView lv = (ListView)sender; ListViewTag lvt = (ListViewTag)lv.Tag; string[] file = {}; DockedItem item = new DockedItem(); FileInfo fi; if (e.Data.GetDataPresent(DataFormats.FileDrop)) { file = (string[])e.Data.GetData(DataFormats.FileDrop); } foreach (string str in file) { item.path = str; Image img = Icon.ExtractAssociatedIcon(str).ToBitmap(); setDockedItemImage(img, item); fi = new FileInfo(str); item.name = fi.Name; if (lv == lvRoot) { dockTree.Insert(dockTree.Count, item); } else { lvt.item.Add(item); } } Save(lv); }
private void newFolderToolStripMenuItem_Click(object sender, EventArgs e) { ListView lv = currentListView; ListViewTag lvt = (ListViewTag)lv.Tag; PopupTextEntry popup = new PopupTextEntry(); popup.Text = "Enter Folder Name"; popup.setTextBoxText("New Folder"); if (popup.ShowDialog() != DialogResult.OK) { return; } DockedItem folder = new DockedItem(popup.getTextBoxText()); Image di = Properties.Resources.defaultIcon; setDockedItemImage(di, folder); folder.folder = true; lvt.item.docklist.Add(folder); Save(lv); }
private void renameFolderToolStripMenuItem_Click(object sender, EventArgs e) { DockedItem item = (DockedItem)((ListViewTag)itemHoverItem.Tag).item; // Let the user enter a new (non-empty) name PopupTextEntry popup = new PopupTextEntry(); popup.Text = "Enter Item Name"; popup.ShowDialog(); if (popup.getTextBoxText() != "") { item.name = popup.getTextBoxText(); } Save(itemHoverItem.ListView); }
private void setDockedItemImage(Image img, DockedItem item) { string newImagePath = iconFolder + "\\icon" + DocketApp.Properties.Settings.Default.iconNumber + Path.GetExtension(selectIcon.FileName); try { img.Save(newImagePath); } catch // Initial creation can be shifted to install // So this should only ever execute if the directory has been deleted or the user changes it in the settings { System.IO.Directory.CreateDirectory(iconFolder); img.Save(newImagePath); } DocketApp.Properties.Settings.Default.iconNumber++; DocketApp.Properties.Settings.Default.Save(); item.image = newImagePath; }
public ListViewTag(DockedItem i) { name = "hi!!"; item = i; }
public void Add(DockedItem item) { docklist.Add(item); }