close

選擇內建郵件選擇器

// 建立一個EmailComposeTask 工作
EmailComposeTask emailComposeTask = new EmailComposeTask();
// 設定郵件標題
emailComposeTask.Subject = AppResources.EmailTitle;
// 設定郵件收件人
emailComposeTask.To = AppResources.EmailTo;
// 發送郵件
emailComposeTask.Show();

 

 

ProblemPage.xaml

<phone:PhoneApplicationPage
x:Class="PhoneApp_Cancer.ProblemPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">

<!--LayoutRoot 是放置所有頁面的根資料格-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<!--TitlePanel 包含應用程式的名稱和頁面標題-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="我要提問" Margin="9,-7,0,0" FontSize="30" />
</StackPanel>
<!--ContentPanel - 其他內容置於此-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<TextBlock FontSize="30" Height="51" HorizontalAlignment="Left" Margin="12,41,0,0" Name="EmailTo" Text="收件人:" VerticalAlignment="Top" Width="136"></TextBlock>
<TextBox Height="72" HorizontalAlignment="Left" Margin="154,19,0,0" Name="EmailToText" Text="{Binding Path=LocalizedResources.EmailTo, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top" Width="308"></TextBox>
<TextBlock FontSize="30" Height="50" HorizontalAlignment="Left" Margin="9,148,0,0" Name="EmailTitle" Text="郵件標題:" VerticalAlignment="Top" Width="136"></TextBlock>
<TextBox Height="72" HorizontalAlignment="Left" Margin="154,126,0,0" Name="EmailTitleText" Text="{Binding Path=LocalizedResources.EmailTitle, Source={StaticResource LocalizedStrings}}" VerticalAlignment="Top" Width="308"></TextBox>
<TextBlock FontSize="30" Height="44" HorizontalAlignment="Left" Margin="12,217,0,0" Name="EmailBody" Text="郵件內容:" VerticalAlignment="Top" Width="147"></TextBlock>
<TextBox Height="248" HorizontalAlignment="Left" Margin="6,267,0,0" Name="EmailBodyText" Text="" VerticalAlignment="Top" Width="460"></TextBox>
<Button Content="發送" Height="72" HorizontalAlignment="Left" Margin="154,521,0,0" Name="ButtonSend" VerticalAlignment="Top" Width="160" Click="ButtonSend_Click"></Button>
</Grid>
</Grid>

</phone:PhoneApplicationPage>

 

 

 

 

ProblemPage.xaml.cs

protected void ButtonSend_Click(object sender, EventArgs e)
{
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.Subject = EmailTitleText.Text.Trim();
emailComposeTask.Body = EmailBodyText.Text.Trim();
emailComposeTask.To = EmailToText.Text.Trim();
emailComposeTask.Show();
}

 

 

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 鴨鴨仔 的頭像
    鴨鴨仔

    DUCK,Fearless!

    鴨鴨仔 發表在 痞客邦 留言(0) 人氣()