private void addToolStripMenuItem_Click(object sender, EventArgs e) { BinderDialog bd = new BinderDialog(); if (bd.ShowDialog() == DialogResult.OK) { Icon ico = Icon.ExtractAssociatedIcon(bd.FileName); ListViewItem item = new ListViewItem(); binderImageList.Images.Add(bd.FileName, ico); item.ImageKey = bd.FileName; item.Text = Path.GetFileName(bd.FileName); item.Tag = bd; binderList.Items.Add(item); } //using(OpenFileDialog ofd = new OpenFileDialog()) //{ // if(ofd.ShowDialog() == DialogResult.OK) // { // Icon ico = Icon.ExtractAssociatedIcon(ofd.FileName); // ListViewItem item = new ListViewItem(); // binderImageList.Images.Add(ofd.FileName,ico); // item.ImageKey = ofd.FileName; // item.Text = Path.GetFileName(ofd.FileName); // binderList.Items.Add(item); // } //} }
private void removeToolStripMenuItem_Click(object sender, EventArgs e) { ListViewItem item = GetSelectedItem(binderList); if (item == null) { return; } BinderDialog bd = (BinderDialog)item.Tag; bd.Dispose(); binderList.Items.Remove(item); }
private void editToolStripMenuItem_Click(object sender, EventArgs e) { ListViewItem item = GetSelectedItem(binderList); if (item == null) { return; } BinderDialog bd = (BinderDialog)item.Tag; if (bd.ShowDialog() == DialogResult.OK) { if (!binderImageList.Images.ContainsKey(bd.FileName)) { Icon ico = Icon.ExtractAssociatedIcon(bd.FileName); binderImageList.Images.Add(bd.FileName, ico); } item.ImageKey = bd.FileName; item.Text = Path.GetFileName(bd.FileName); } }
private SettingsFile GetSettings() { SettingsFile sf = new SettingsFile(); sf.EncryptFiles = checkBox2.Checked; sf.CompressFiles = checkBox1.Checked; sf.BindFiles = new List <BinderSetting>(); foreach (ListViewItem itm in binderList.Items) { BinderDialog bd = (BinderDialog)itm.Tag; sf.BindFiles.Add(bd.GetSettings()); } sf.DownloadFiles = new List <DownloaderSetting>(); foreach (ListViewItem itm in downloaderList.Items) { DownloaderDialog bd = (DownloaderDialog)itm.Tag; sf.DownloadFiles.Add(bd.GetSettings()); } sf.AssemblyDescription = asmDescriptionText.Text; sf.AssemblyCopyright = asmCopyrightText.Text; sf.AssemblyCompany = asmCompanyText.Text; sf.AssemblyProductName = asmProductNameText.Text; sf.AssemblyVersion = asmVersionText.Text; sf.IconPath = iconText.Text; return(sf); }