本文整理汇总了C#中Android.Content.Intent.AddAttachments方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.AddAttachments方法的具体用法?C# Intent.AddAttachments怎么用?C# Intent.AddAttachments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Intent
的用法示例。
在下文中一共展示了Intent.AddAttachments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowDraft
/// <summary>
/// Shows the draft.
/// </summary>
/// <param name="subject">The subject.</param>
/// <param name="body">The body.</param>
/// <param name="html">if set to <c>true</c> [HTML].</param>
/// <param name="to">To.</param>
/// <param name="cc">The cc.</param>
/// <param name="bcc">The BCC.</param>
/// <param name="attachments">The attachments.</param>
public void ShowDraft(string subject, string body, bool html, string[] to, string[] cc, string[] bcc, IEnumerable<string> attachments = null)
{
var intent = new Intent(Intent.ActionSend);
intent.SetType(html ? "text/html" : "text/plain");
intent.PutExtra(Intent.ExtraEmail, to);
intent.PutExtra(Intent.ExtraCc, cc);
intent.PutExtra(Intent.ExtraBcc, bcc);
intent.PutExtra(Intent.ExtraSubject, subject ?? string.Empty);
if (html)
{
intent.PutExtra(Intent.ExtraText, Android.Text.Html.FromHtml(body));
}
else
{
intent.PutExtra(Intent.ExtraText, body ?? string.Empty);
}
if (attachments != null)
{
intent.AddAttachments (attachments);
}
this.StartActivity(intent);
}
示例2: ShowDraft
public void ShowDraft(string subject, string body, bool html, string to, IEnumerable<string> attachments)
{
var intent = new Intent(Intent.ActionSend);
intent.SetType(html ? "text/html" : "text/plain");
intent.PutExtra(Intent.ExtraEmail, to);
intent.PutExtra(Intent.ExtraSubject, subject ?? string.Empty);
if (html)
{
intent.PutExtra(Intent.ExtraText, body);
}
else
{
intent.PutExtra(Intent.ExtraText, body ?? string.Empty);
}
intent.AddAttachments(attachments);
this.StartActivity(intent);
}