private void inboxDataGridView_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } Debug.WriteLine("Current Row: " + e.RowIndex.ToString()); Debug.WriteLine("Mail-ID: " + inboxDataGridView.Rows[e.RowIndex].Cells["Mail-ID"].FormattedValue.ToString()); string mail_id = inboxDataGridView.Rows[e.RowIndex].Cells["Mail-ID"].FormattedValue.ToString(); MailContent = new Dictionary<string,string>(); dbHandler = new DBHandler(); MailContent = dbHandler.GetFullMailFromMailID(mail_id); ShowMailWindow = new ShowMail(MailContent["recipient"],MailContent["sender"], MailContent["subject"],MailContent["message"]); ShowMailWindow.Show(); }
public MailClient() { this.Load += MailClient_Load; InitializeComponent(); pop3 = new POPClient(); smtp = new SMTPClient(); dbHandler = new DBHandler(); POP3Worker = new BackgroundWorker(); POP3Worker.WorkerReportsProgress = true; POP3Worker.DoWork += new DoWorkEventHandler(pop3.GetAllMails); POP3Worker.ProgressChanged += new ProgressChangedEventHandler(WorkerProgressChanged); POP3Worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(WorkerRunCompleted); SMTPWorker = new BackgroundWorker(); SMTPWorker.DoWork += new DoWorkEventHandler(smtp.Send); SMTPWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(sendWorkerRunCompleted); }
private void inbox_btn_Click(object sender, EventArgs e) { Mail_Groupbox.Visible = false; inboxDataGridView.Visible = true; ActiveWindow = "inbox"; /* Load empty table and do UI optimization*/ table = new DataTable(); table.Columns.Add("Mail-ID", typeof(int)); table.Columns.Add("From", typeof(string)); table.Columns.Add("Subject", typeof(string)); inboxDataGridView.DataSource = table; inboxDataGridView.RowHeadersVisible = false; inboxDataGridView.Columns["Mail-ID"].Visible = false; inboxDataGridView.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None; /* Get all Subjects and Senders from DB */ dbHandler = new DBHandler(); inboxDataGridView.DataSource = dbHandler.GetAllSendersSubjects(); }
private void sendReceive_btn_Click(object sender, EventArgs e) { dbHandler = new DBHandler(); List<Message> mails = new List<Message>(); mails = POPClient.GetAllMails(Setting.Default.pop3_server, Setting.Default.pop3_port, Setting.Default.ssl, Setting.Default.username, Setting.Default.password); foreach (Message mail in mails) { dbHandler.InsertMail(mail); } }