private void done_Click(object sender, RoutedEventArgs e) { if (Pass.Password.Length < 12) { MessageBox.Show("The password should be more than 12 character"); } else if (this.win.GetType() == (typeof(email_encrpt.LoginWindow))) { check = true; if (win.IsVisible == false) { this.win.Show(); } System.IO.Directory.CreateDirectory(@"C:\EasySecurity"); Crypto.KeyVault.SaveRSAParamaters(Pass.Password); File.Create("C:/EasySecurity/first.bmv"); this.Close(); win.Show(); } else if (this.win.GetType() == (typeof(email_encrpt.Message_Window))) { try { string message = Crypto.Encryption.DecryptMessage((this.win as email_encrpt.Message_Window).message.Body.Text, Pass.Password); (this.win as Message_Window).wb1.NavigateToString(HTMLEncoding.TextToHTML(message)); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } this.Close(); } }
public Message_Window(ImapX.Message message) { InitializeComponent(); this.message = message; if (this.message.Body.HasHtml) { wb1.NavigateToString(message.Body.Html); } else if (this.message.Body.HasText) { wb1.NavigateToString(HTMLEncoding.TextToHTML(message.Body.Text)); } from.Text = this.message.From.ToString(); subject.Text = this.message.Subject; time.Text = this.message.Date.Value.ToString(); }