从Windows Phone 7应用程序发送短信

时间:2014-02-17 12:17:44

标签: c# windows-phone-7 sms

在我的Windows Phone 7应用程序中,我想发送短信,其中邮件正文应包含我的应用程序中上一页的数据。我想要显示的数据是:

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;
        }

我在按钮点击事件中编写了以下代码:

 private void btn_text_Click(object sender, RoutedEventArgs e)
    {


        SmsComposeTask smsComposeTask = new SmsComposeTask();

        smsComposeTask.To = "+91-9778999";
        smsComposeTask.Body = title + "," + description + "," + datee;

        smsComposeTask.Show();

        my_popup_cs.IsOpen = false;
    }

我希望结果为标题,描述和日期的值。但在消息体中我得到的结果为:

System.WIndows.Controls.TextBLock, System.WIndows.Controls.TextBLock,   System.WIndows.Controls.TextBLock

但是我只在模拟器中测试过。是否可以在模拟器中显示结果?或者请看看我的代码

1 个答案:

答案 0 :(得分:1)

我看到你的代码。应该这样。

smsComposeTask.Body = title.Text + "," + description.Text + "," + datee.Text;

请试一试。