private void CertificateReceived(object sender, CertificateReceivedEventArgs args) { try { try { if (!Directory.Exists(PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY)) { Directory.CreateDirectory(PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY); } } catch (Exception ex) { this.LogMessage(String.Format(Properties.Resources.Cannot_create_default_account_data_directory_, PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY, ex.Message), true); return; } args.Certificate.SaveCrtToAppData(); args.Certificate.SavePkcs12ToAppData(args.Certificate.Password); HaveCertificate = true; this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { this.P2PEditor.GuiLogMessage(String.Format(Properties.Resources.Autodownloaded_user_account_data_for_user_, args.Certificate.Avatar), NotificationLevel.Info); }, null); } catch (Exception ex) { this.LogMessage(String.Format(Properties.Resources.Could_not_save_the_received_certificate_to_your_AppData_folder_, (ex.GetBaseException() != null && ex.GetBaseException().Message != null ? ex.GetBaseException().Message : ex.Message))); } }
public void CertificateReceived(object sender, CertificateReceivedEventArgs args) { try { args.Certificate.SaveCrtToAppData(); args.Certificate.SavePkcs12ToAppData(args.Certificate.Password); System.Windows.MessageBox.Show("Certificate received and stored.", "Certificate received and stored"); this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { this.UsernameField.Text = ""; this.EmailField.Text = ""; this.PasswordField.Password = ""; this.ConfirmField.Password = ""; }, null); } catch (Exception ex) { System.Windows.MessageBox.Show("Could not save the received certificate to your AppData folder:\n\n" + (ex.GetBaseException() != null && ex.GetBaseException().Message != null ? ex.GetBaseException().Message : ex.Message), "Error while saving the certificate"); } finally { Requesting = false; } }
public void CertificateReceived(object sender, CertificateReceivedEventArgs args) { try { if (!Directory.Exists(PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY)) { Directory.CreateDirectory(PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY); this.P2PEditor.GuiLogMessage("Automatic created account folder: " + PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY, NotificationLevel.Info); } } catch (Exception ex) { this.MessageLabel.Text = "Cannot create default account data directory '" + PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY + "':\n" + ex.Message; this.P2PEditor.GuiLogMessage(this.MessageLabel.Text.ToString(), NotificationLevel.Error); this.MessageLabel.Visibility = Visibility.Visible; return; } try { args.Certificate.SaveCrtToAppData(); args.Certificate.SavePkcs12ToAppData(args.Certificate.Password); this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { this.PasswordField.Password = ""; this.ActivatePage.Visibility = System.Windows.Visibility.Hidden; this.OKPage.Visibility = System.Windows.Visibility.Visible; }, null); } catch (Exception ex) { this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { this.MessageLabel.Text = "Could not save the received certificate to your AppData folder:\n\n" + (ex.GetBaseException() != null && ex.GetBaseException().Message != null ? ex.GetBaseException().Message : ex.Message); this.P2PEditor.GuiLogMessage(this.MessageLabel.Text.ToString(), NotificationLevel.Error); this.MessageLabel.Visibility = Visibility.Visible; }, null); } finally { Requesting = false; } }
public void CertificateReceived(object sender, CertificateReceivedEventArgs args) { try { try { if (!Directory.Exists(PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY)) { Directory.CreateDirectory(PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY); this.P2PEditor.GuiLogMessage(String.Format(Properties.Resources.Automatic_created_account_folder_, PeerCertificate.DEFAULT_USER_CERTIFICATE_DIRECTORY), NotificationLevel.Info); } } catch (Exception ex) { this.LogMessage(String.Format(Properties.Resources.Cannot_create_default_account_data_directory_, ex.Message), true); return; } args.Certificate.SaveCrtToAppData(); args.Certificate.SavePkcs12ToAppData(args.Certificate.Password); this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback) delegate { ((P2PEditorPresentation)((P2PEditor)GetValue(P2PEditorProperty)).Presentation).Connect.Username.Text = this.UsernameField.Text; ((P2PEditorPresentation)((P2PEditor)GetValue(P2PEditorProperty)).Presentation).Connect.Password.Password = this.PasswordField.Password; this.UsernameField.Text = ""; this.EmailField.Text = ""; this.PasswordField.Password = ""; this.ConfirmField.Password = ""; this.RequestPage.Visibility = System.Windows.Visibility.Hidden; this.OKPage.Visibility = System.Windows.Visibility.Visible; }, null); } catch (Exception ex) { this.LogMessage(String.Format(Properties.Resources.Could_not_save_the_received_certificate_to_your_AppData_folder_, (ex.GetBaseException() != null && ex.GetBaseException().Message != null ? ex.GetBaseException().Message : ex.Message)), true); } finally { Requesting = false; } }
private void OnCertificateReceived(CertificateReceivedEventArgs arg) { CertificateHelper.StoreCertificate(arg.Certificate, arg.Password, arg.Certificate.Avatar); LoadLocalCertificateAndLogin(); }
private void OnCertificateReceived(CertificateReceivedEventArgs arg) { CertificateHelper.StoreCertificate(arg.Certificate, arg.Password, arg.Certificate.Avatar); ShowSuccessMessage(); }