WP7 send SMS

Source: Internet
Author: User






<! -- Titlepanel contains applicationsProgramName and page title -->

<Stackpanel X: Name = "titlepanel" grid. Row = "0" margin = ",">

<Textblock X: Name = "applicationtitle" text = "My applications" style = "{staticresource phonetextnormalstyle}"/>

<Textblock X: Name = "pagetitle" text = "send SMS" margin = "9,-7,0, 0" style = "{staticresource phonetexttitle1style}"/>

</Stackpanel>

<! -- Contentpanel-place other content here -->

<Grid X: Name = "contentpanel" grid. Row = "1" margin = "12,0, 12,0">

<Textblock Height = "40" horizontalalignment = "Left" margin = "25, 16," name = "textblock1" text = "Recipient: "verticalalignment =" TOP "fontsize =" 30 "width =" 144 "/>

<Textbox Height = "72" horizontalalignment = "Left" margin = "444," name = "txtphonenumber" text = "" verticalalignment = "TOP" width = "">

<Textbox. inputscope>

<Inputscope>

<Inputscopename namevalue = "Number"/>

</Inputscope>

</Textbox. inputscope>

</Textbox>

<Textblock textwrapping = "Wrap" fontsize = "30" Height = "177" horizontalalignment = "Left" margin = "6,270, 0, 0 "name =" textblock2 "text =" text message content "verticalalignment =" TOP "width =" 46 "/>

<Textbox Height = "406" horizontalalignment = "Left" margin = "48,140, 382 "name =" txtmessage "text =" "verticalalignment =" TOP "width =" "textwrapping =" Wrap "/>

<Button content = "send" Height = "79" horizontalalignment = "Left" margin = "-12,538, 480 "name =" btnsend "verticalignment =" TOP "width =" "Click =" btnsend_click "/>

<Button content = "Select phone number" Height = "69" horizontalalignment = "Left" margin = "210,0, 220 "name =" btnchoose "verticalignment =" TOP "width =" "Click =" btnchoose_click "/>

</GRID>

</GRID>

BackgroundCode:

Phonenumberchoosertask mychooser = new phonenumberchoosertask ();
Smscomposetask SMS = NULL;

// constructor
Public mainpage ()
{< br> initializecomponent ();
// instantiate
SMS = new smscomposetask ();
// register a callback event
mychooser. completed + = (sender, e) =>
{< br> If (E. taskresult = taskresult. OK)
{< br> dispatcher. begininvoke () => {this.txt phonenumber. TEXT = E. phonenumber ;});
}< BR >};
}

// select the contact
private void btnchoose_click (Object sender, routedeventargs e)
{< br> If (mychooser = NULL)
{< br> mychooser = new phonenumberchoosertask ();
}< br> mychooser. show ();
}

// send
private void btnsend_click (Object sender, routedeventargs e)
{< br> If (txtphonenumber. TEXT = "" | txtmessage. TEXT = "")
{< br> MessageBox. show ("the recipient number and text message content cannot be blank. ");
return;
}< br> If (SMS = NULL)
{< br> SMS = new smscomposetask ();
}< br> // value assignment
SMS. to = txtphonenumber. text;
SMS. body = txtmessage. text;

Try
{
SMS. Show ();
}
Catch (exception ex)
{
MessageBox. Show (ex. Message );
}
}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.