Windows Phone 8.1 連絡人與日曆

來源:互聯網
上載者:User

標籤:des   c   style   class   blog   code   

(1)連絡人(Manifest 擷取許可權)

1)擷取連絡人

擷取連絡人的方式有兩種

A. ContactPicker

ContactPicker 也就是直接開啟一個系統的選擇連絡人介面,讓使用者選擇,可設定單選或多選:

var contactPicker = new ContactPicker();contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber);//Windows.ApplicationModel.Contacts.Contact contact = await contactPicker.PickContactsAsync();Windows.ApplicationModel.Contacts.Contact contact = await contactPicker.PickContactAsync();if( contact != null ){    MessageDialog dialog = new MessageDialog(string.Format("Phone Number: {0}", contact.Phones.First().Number), contact.DisplayName);    await dialog.ShowAsync();}

必須設定唯一的一個 ContactFieldType。

B. ContactManager

可通過 ContactManager API 直接搜尋某連絡人:

ContactStore contactStore = await ContactManager.RequestStoreAsync();var list = await contactStore.FindContactsAsync(searchTextBox.Text.Trim());

擷取的連絡人清單為唯讀。

2)與連絡人聯絡

可直接向連絡人撥打到電話、傳送簡訊、發送郵件:

PhoneCallManager.ShowPhoneCallUI("15911111111", "Some");ChatMessage message = new ChatMessage();message.Recipients.Add("15911111111");message.Body = "Test.";await ChatMessageManager.ShowComposeSmsMessageAsync(message);EmailMessage email = new EmailMessage();email.To.Add(new EmailRecipient("[email protected]"));email.Body = "Test.";await EmailManager.ShowComposeNewEmailAsync(email);

 

(2)日曆

1)直接開啟系統的日曆應用

比如開啟日曆主介面:

await AppointmentManager.ShowTimeFrameAsync(DateTimeOffset.Now, TimeSpan.FromHours(1));

 

2)API 方式

比如建立一個日曆事件:

Appointment appointment = new Appointment();appointment.Subject = "";appointment.StartTime = DateTimeOffset.Now;//...await AppointmentManager.ShowAddAppointmentAsync(appointment, new Rect());

更多 API :連結

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.