在我的Windows Phone 7應用程序中,我想發送一封電子郵件,其中郵件正文應該包含我的應用程序中上一頁的數據。以前我只是集成了電子郵件工具是這樣的:從Windows Phone 7應用程序發送電子郵件
private void Image_Email(object sender, RoutedEventArgs e)
{
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.Subject = "message subject";
emailComposeTask.Body = "message body";
emailComposeTask.To = "[email protected]";
emailComposeTask.Cc = "[email protected]";
emailComposeTask.Bcc = "[email protected]";
emailComposeTask.Show();
}
但我不能在我的模擬器來測試這一點。現在在body
部分我想要我的數據來自上一頁。那麼如何做到這一點?
更新代碼:
if (this.NavigationContext.QueryString.ContainsKey("Date_Start"))
{
//if it is available, get parameter value
date = NavigationContext.QueryString["Date_Start"];
datee.Text = date;
}
if (this.NavigationContext.QueryString.ContainsKey("News_Title"))
{
//if it is available, get parameter value
ntitle = NavigationContext.QueryString["News_Title"];
title.Text = ntitle;
}
if (this.NavigationContext.QueryString.ContainsKey("News_Description"))
{
ndes = NavigationContext.QueryString["News_Description"];
description.Text = ndes;
}
現在應該做些什麼在郵件正文中寫?我無法測試它,因爲我沒有設備。 我可以通過在這樣的價值觀:
emailComposeTask.Body = "title, ndes, date";
請參閱我的更新代碼。這是寫它的方式嗎? – bhaku
看到我更新的代碼。 –
嗨,@ bhaku,你有沒有讀過代碼?有什麼問題嗎? –