/// <summary> /// Tira um screenshot do Scorecard, enviando para o email do jogador /// da propriedade JogadorAEnviarPrint. /// </summary> private async Task TirarPrint() { ActivityIndicatorTool.ExecutarRoda(); //Tirar screenshot. byte[] screenshot = await _screenshotService.TirarScreenshotAsync(); //Guardar screenshot como anexo do email. MimeKit.AttachmentCollection attachments = new MimeKit.AttachmentCollection(); attachments.Add("ScorecardPNG,", screenshot, ContentType.Parse("image/png")); //Enviar Email. try { await _emailService.EnviarEmail(emailDestino : JogadorAEnviarPrint.Email, assunto : "IT4ClubCar Game Results", mensagemConteudo : "Like you asked :)", attachments : attachments); await base.NavigationService.SairDeScorecard(); } catch (SaslException e) { await base.DialogService.MostrarMensagem("Error while sending the email. Please try again later"); } catch (AuthenticationException e) { await base.DialogService.MostrarMensagem("Error while sending the email. Please try again later"); } ActivityIndicatorTool.PararRoda(); }
private AttachmentCollection BuildAttachmentCollection(List <Attachment> attachments) { var attachmentCollection = new AttachmentCollection(); foreach (var attachment in attachments) { var mimePart = new MimePart(attachment.Type, attachment.SubType) { Content = new MimeContent(attachment.Content, ContentEncoding.Default), ContentDisposition = new ContentDisposition(ContentDisposition.Attachment), ContentTransferEncoding = ContentEncoding.Base64, FileName = attachment.Name }; attachmentCollection.Add(mimePart); } return(attachmentCollection); }