/// <summary> /// Method for load messages. /// </summary> /// <param name="mailMessage">The mail messages.</param> /// <param name="type">The mail sender type.</param> public void LoadMessage(MailMessage mailMessage, MailSenderType type) { // the current mailbox. string mailbox = MainForm.GetInstance().GetSelectedMailbox(); // retrieve the message body. string body = Facade.GetInstance().GetMessageBodyString(mailMessage, mailbox); // load message to. if (type == MailSenderType.Reply) { this.tbTo.Text = mailMessage.From; } else if (type == MailSenderType.ReplyToAll) { string to = mailMessage.From; if (to.Length > 0) { to = string.Concat(to, ", ", mailMessage.To); } this.tbTo.Text = to; } // load message subject. if (type == MailSenderType.Reply || type == MailSenderType.ReplyToAll) { this.tbSubject.Text = string.Concat("Re: ", mailMessage.Subject); } else if (type == MailSenderType.Forward) { this.tbSubject.Text = string.Concat("Fwd: ", mailMessage.Subject); } // TODO: load message attachments. // load message body. if (type == MailSenderType.Reply || type == MailSenderType.ReplyToAll) { StringBuilder sb = new StringBuilder(); sb.Append(Environment.NewLine); sb.Append(Environment.NewLine); sb.Append("On "); sb.Append(mailMessage.SentDate); sb.Append(", "); sb.Append(mailMessage.From); sb.Append(" wrote:"); sb.Append(Environment.NewLine); sb.Append(body); this.htmlEditorControl.InnerText = sb.ToString(); } else if (type == MailSenderType.Forward) { StringBuilder sb = new StringBuilder(); sb.Append(Environment.NewLine); sb.Append(Environment.NewLine); sb.Append("---------- Forwarded message ----------"); sb.Append(Environment.NewLine); sb.Append("From: "); sb.Append(mailMessage.From); sb.Append(Environment.NewLine); sb.Append("Date: "); sb.Append(mailMessage.SentDate); sb.Append(Environment.NewLine); sb.Append("Subject: "); sb.Append(mailMessage.Subject); sb.Append(Environment.NewLine); sb.Append("To: "); sb.Append(mailMessage.To); sb.Append(Environment.NewLine); sb.Append(Environment.NewLine); sb.Append(body); sb.Append(Environment.NewLine); this.htmlEditorControl.InnerText = sb.ToString(); } }