本文整理汇总了C#中IEmailService.ShowDraft方法的典型用法代码示例。如果您正苦于以下问题:C# IEmailService.ShowDraft方法的具体用法?C# IEmailService.ShowDraft怎么用?C# IEmailService.ShowDraft使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEmailService
的用法示例。
在下文中一共展示了IEmailService.ShowDraft方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmailPage
/// <summary>
/// Initializes a new instance of the <see cref="EmailPage"/> class.
/// </summary>
public EmailPage()
{
Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
_emailService = Resolver.Resolve<IEmailService>();
SetupCamera();
Status = "Ready";
var stack = new StackLayout();
if (_emailService == null || !_emailService.CanSend)
{
stack.Children.Add(new Label
{
TextColor = Color.Red,
Text = "No Email support",
});
}
else
{
var buttonTakePicture = new Button
{
Text = "Take Picture",
};
var buttonSendEmail = new Button
{
Text = "Send Email",
};
var buttonSendEmailWithAttachment = new Button
{
Text = "Send Email with Attachment",
IsEnabled = false,
};
buttonTakePicture.Clicked += async (sender, args) =>
{
await TakePicture();
buttonSendEmailWithAttachment.IsEnabled = !string.IsNullOrEmpty(_path);
};
buttonSendEmail.Clicked += (sender, args) => _emailService.ShowDraft(
"Test Subject",
"Test Body",
true,
string.Empty,
Enumerable.Empty<string>());
buttonSendEmailWithAttachment.Clicked += (sender, args) =>
{
if (string.IsNullOrEmpty(_path))
{
DisplayAlert("Error", "You must first take a pictures.", null, "OK");
}
else
{
_emailService.ShowDraft(
"Test Subject",
"Test Body",
true,
string.Empty,
new List<string> { _path });
}
};
var labelStatus = new Label
{
Text = string.Empty,
VerticalOptions = LayoutOptions.EndAndExpand,
HorizontalOptions = LayoutOptions.StartAndExpand
};
labelStatus.SetBinding(Label.TextProperty, new Binding(Status));
stack.Children.Add(buttonTakePicture);
stack.Children.Add(buttonSendEmail);
stack.Children.Add(buttonSendEmailWithAttachment);
stack.Children.Add(labelStatus);
}
Content = stack;
}