Windows Phone 8.1 Common launcher instances

Source: Internet
Author: User

---restore content starts---

Small dream today to share with you the Windows Phone 8.1 common launcher instances, including:

    • Phone launcher
    • SMS Launcher
    • Mail launcher
    • Add Appointment | Memo to Calendar
    • Map Launcher
    • Map Route Launcher
Windows Phone 8.1 Common launcher-phone launcher:

We use Phonecallmanager's Showphonecallui method to implement call calls. The code is as follows:

private void Button_Click (object sender, RoutedEventArgs e)//Telephone Initiator
{
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI ("10000″," "China Telecom");//The first parameter is the number of the calling telephone, The second parameter is actually the name that appears on your phone
}

The results of the operation are as follows:

Windows Phone 8.1 Common Launcher-SMS launcher:

We use Chatmessagemanager's Showcomposesmsmessageasync method to send text messages. The method receives a parameter that is a Chatmessage object

Private Async voidButton_click_1 (Objectsender, RoutedEventArgs e)//SMS Launcher{Windows.ApplicationModel.Chat.ChatMessage msg=NewWindows.ApplicationModel.Chat.ChatMessage (); Msg. Body= "Programming small dream-focus on Windows Phone app development";//main content of SMSMsg. Recipients.add ("10086″);//recipients of SMS can add multipleMsg. Recipients.add ("10010″);awaitWindows.ApplicationModel.Chat.ChatMessageManager.ShowComposeSmsMessageAsync (msg);}

The results are as follows:

Windows Phone 8.1 Common Launcher-mail launcher:

We use Emailmanager's Showcomposenewemailasync method to deliver the message. The method receives a parameter that is a Emailmessage object

Private Async voidButton_click_2 (Objectsender, RoutedEventArgs e) {varFile =awaitgetattachment (); Windows.ApplicationModel.Email.EmailAttachment emailattachment=NewWindows.ApplicationModel.Email.EmailAttachment (file. Name, file);//add a file to an attachment in a messageWindows.ApplicationModel.Email.EmailMessage mail =NewWindows.ApplicationModel.Email.EmailMessage (); mail. Attachments.Add (emailattachment);//add an attachment to a messageMail. Subject = "Windows Phone app development";//subject of the messageMail. Body = "Programming Little Dream-focus on Windows Phone app development";//content of the messageMail. To.add (NewWindows.ApplicationModel.Email.EmailRecipient ("5931110254@qq. com "," Little Dream "));//accepted address and display name for the messageawaitWindows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync (mail);}Private AsyncTask<storagefile> getattachment ()//get attachments to messages{varfolder = Windows.Storage.ApplicationData.Current.LocalFolder;//gets the root folder of the storevarsubfolder =awaitFolder. Createfolderasync ("MyFolder", Windows.Storage.CreationCollisionOption.OpenIfExists);//Create a new folder named MyFoldervarFile =awaitsubfolder. Createfileasync ("MyAttachment.txt", Windows.Storage.CreationCollisionOption.ReplaceExisting);//Create a new file named MyAttachment.txtawaitWindows.Storage.FileIO.WriteTextAsync (file, "Hello Little Dream!") ”);//write to the file "Hello Little Dream!" "As the content of the filereturnfile;}

Run effect

Windows Phone 8.1 Common launcher--Add appointments | Memo to calendar:

We use Appointmentmanager's Showaddappointmentasync method to add our defined appointments to the calendar and to manage existing appointments. The method receives the parameter as a appointment object.

Private Async voidButton_click_3 (Objectsender, RoutedEventArgs e)//Add appointments, Memo to calendar{Windows.ApplicationModel.Appointments.Appointment Appointment=NewWindows.ApplicationModel.Appointments.Appointment (); appointment. AllDay=false;//whether all dayAppointment. Details = "Programming Small dreams-Dream friends Gathering";//details of the appointment, memoAppointment. Duration = Timespan.fromhours (2.0);//the duration of the memoAppointment. Location = "Beijing";//the place of the appointmentAppointment. StartTime = DateTime.Now;//start time of the appointmentAppointment. Subject = "Dream Friends Gathering";//topic of the appointmentawaitWindows.ApplicationModel.Appointments.AppointmentManager.ShowAddAppointmentAsync (Appointment,NewRect ());}

The effect is the first picture, after you open the calendar you can see the second, three pictures:

Windows Phone 8.1 Common Launcher-MAP launcher:

The Uri,uri format that we use Windows.System.Launcher's Launchuriasync to launch Bing Maps is Bingmaps:uri scheme. For specific URI scheme, please refer to: URI scheme for maps application.

Private Async void Button_click_4 (object sender, RoutedEventArgs e)// map query {await Windows.System.Launcher.LaunchUriAsync (new Uri ("bingmaps:?lvl=&where= Xian" , Urikind.absolute)); // LVL represents the zoom precision where is the location }

Run effect

Windows Phone 8.1 Common launcher--map route launcher:
Private Async void Button_click_5 (object sender, RoutedEventArgs e)// Map route query {await Windows.System.Launcher.LaunchUriAsync (new Uri ("Bingmaps:?rtp=adr. BEIJING ~adr. Xi ' an", Urikind.absolute)); // find a route from Beijing to Xian }

The results are as follows:

Windows Phone 8.1 launcher full source code download

---restore content ends---

Windows Phone 8.1 Common launcher instances

Related Article

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.