private async Task CreateCertificateAsync() { try { var certificateFormat = InferFormat(); if (certificateFormat == null) { Debug.Assert(false, "Create button should not have enabled when we were unable to infer a certificate format"); return; } CreateCertificateOptions options = new CreateCertificateOptions { FilePath = FilePath, CertificateFormat = certificateFormat.Value, Password = Password, }; await this.batchService.CreateCertificateAsync(options); Messenger.Default.Send <RefreshMessage>(new RefreshMessage(RefreshTarget.Certificates)); Messenger.Default.Send(new GenericDialogMessage(string.Format("Successfully uploaded certificate from {0}", this.FilePath))); this.FilePath = string.Empty; //So that the user doesn't accidentally try to upload the same certificate twice } catch (Exception e) { Messenger.Default.Send <GenericDialogMessage>(new GenericDialogMessage(e.ToString())); } }
public Task CreateCertificateAsync(CreateCertificateOptions options) { Certificate certificate; switch (options.CertificateFormat) { case CertificateFormat.Pfx: certificate = this.Client.CertificateOperations.CreateCertificate(options.FilePath, options.Password); break; case CertificateFormat.Cer: certificate = this.Client.CertificateOperations.CreateCertificate(options.FilePath); break; default: throw new ArgumentException("Invalid certificate format " + options.CertificateFormat); } return(certificate.CommitAsync()); }
public Task CreateCertificateAsync(CreateCertificateOptions options) { return(this.Service.CreateCertificateAsync(options)); }