private void addToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog open = new OpenFileDialog(); if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (string file in open.FileNames) { MNAttachment ath = new MNAttachment(file); ListViewItem item = new ListViewItem(new string[] { ath.FileName, ath.Size.ToString() }); this.attList.Items.Add(item); } } open.Dispose(); }
private void creatProfile(string filename) { if (File.Exists(filename)) { File.Delete(filename); } this.setConfig(this._config); using (var db = OdbFactory.Open(filename)) { foreach (ListViewItem item in this.grid.Items) { MailRecipent p = new MailRecipent(); p.Checked = item.Checked; p.Index = int.Parse(item.Text); p.Name = item.SubItems[1].Text; p.Address = item.SubItems[2].Text; p.Status = item.SubItems[4].Text; if (item.SubItems[3].Text == "") p.SendTime = ""; else p.SendTime = item.SubItems[3].Text; db.Store(p); } db.Store(this._config); foreach (ListViewItem item in this.attList.Items) { MNAttachment ath = new MNAttachment(item.Text); db.Store(ath); } } }