Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

GH-620: Integrate html option into sample for email. #623

Merged
merged 1 commit into from
Nov 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Samples/Samples.Android/Samples.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<EnableLLVM>false</EnableLLVM>
<BundleAssemblies>false</BundleAssemblies>
<EnableProguard>true</EnableProguard>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidUseSharedRuntime>true</AndroidUseSharedRuntime>
<EmbedAssembliesIntoApk>false</EmbedAssembliesIntoApk>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down
7 changes: 6 additions & 1 deletion Samples/Samples/View/EmailPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@
<Entry Text="{Binding RecipientsBcc}" />
<Label Text="Subject:" />
<Entry Text="{Binding Subject}" />
<StackLayout Orientation="Horizontal">
<Label Text="Is Html?" HorizontalTextAlignment="End" HorizontalOptions="FillAndExpand" VerticalOptions="Center"/>
<Switch IsToggled="{Binding IsHtml}" VerticalOptions="Center"/>
</StackLayout>
<Label Text="Body:" />
<Editor Text="{Binding Body}" Keyboard="Chat"
VerticalOptions="FillAndExpand" HeightRequest="200" />
AutoSize="TextChanges"
VerticalOptions="FillAndExpand" HeightRequest="100" />

</StackLayout>
</ScrollView>
Expand Down
8 changes: 8 additions & 0 deletions Samples/Samples/ViewModel/EmailViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class EmailViewModel : BaseViewModel
string recipientsTo;
string recipientsCc;
string recipientsBcc;
bool isHtml;

public EmailViewModel()
{
Expand Down Expand Up @@ -52,6 +53,12 @@ public string RecipientsBcc
set => SetProperty(ref recipientsBcc, value);
}

public bool IsHtml
{
get => isHtml;
set => SetProperty(ref isHtml, value);
}

async void OnSendEmail()
{
if (IsBusy)
Expand All @@ -64,6 +71,7 @@ await Email.ComposeAsync(new EmailMessage
{
Subject = Subject,
Body = Body,
BodyFormat = isHtml ? EmailBodyFormat.Html : EmailBodyFormat.PlainText,
To = Split(RecipientsTo),
Cc = Split(RecipientsCc),
Bcc = Split(RecipientsBcc),
Expand Down