Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        private MailRecipent getRecipent(int i)
        {
            if (this.grid.InvokeRequired)
            {
                return (MailRecipent)this.grid.Invoke(
                    new Func<MailRecipent>(() => getRecipent(i))
                    );
            }
            else
            {   
                if (i >= 0)
                {  
                    ListViewItem item = this.grid.Items[i];

                    MailRecipent rp = rp = new MailRecipent();

                    rp.Checked = item.Checked;
                    rp.Index = int.Parse(item.Text);
                    rp.Name = item.SubItems[1].Text;
                    rp.Address = item.SubItems[2].Text;
                    rp.SendTime = item.SubItems[3].Text;
                    rp.Status = item.SubItems[4].Text;

                    return rp;                        
                }
                else
                {
                    return null;
                }            
            }      
        }