[Windows Phone] compose SMS function method

APP wants to develop their own various functions it! In this article I will write the simplest way to explain the importance of SMS function.


Foreword

APP wants to develop their own various functions it! In this article I will write the simplest way to explain the importance of SMS function.

Explanation


// 建立发送简讯的启动器对象
Microsoft.Phone.Tasks.SmsComposeTask 对象 = new Microsoft.Phone.Tasks.SmsComposeTask();

The above object provides the following members (properties or methods) can be used to specify the information to send a letter:

To: Specifies the recipient's phone

Body: SMS content

Show (): call the system built-in SMS sending program

method

Step1: construction projects

Step2: Screen Design

The following screen disposed within the Grid, its important controls as follows:

  • 1. TextBox controls, Name Properties -> txtPhone
  • 2. TextBox controls, Name Properties -> txtSMS
  • 3. Button controls, Name Properties -> btnSend, Content Properties -> Transfer

Screen configuration as shown below:

XAML procedure occurs as follows:



  
  
        
  
  
            
   
   
            
   
    
            
   
     
            
   
       
        
      
     
    
   
  

Step3: event handler


// 建构函数
        public MainPage()
        {
            InitializeComponent();

            // 将 ApplicationBar 当地语系化的程序范例
            //BuildLocalizedApplicationBar();
            btnSend.Click += btnSend_Click;
        }

        void btnSend_Click(object sender, RoutedEventArgs e)
        {
            // 建立发送简讯的启动器对象
            Microsoft.Phone.Tasks.SmsComposeTask sms = new Microsoft.Phone.Tasks.SmsComposeTask();
            // 指定收件人电话
            sms.To = txtPhone.Text;
            // 指定简讯内容
            sms.Body = txtSMS.Text;
            // 启动发送简讯
            sms.Show();

        }

result

Specify the content of the message recipient.

SMS sent successfully

Epilogue

Compose SMS function method is simple, provided here for your reference ^ ^

Download example

SmsPhoneApp.zip

Original: Large column  [Windows Phone] compose SMS function method


Guess you like

Origin www.cnblogs.com/chinatrump/p/11490925.html