介紹
與眾不同 windows phone 7.5 (sdk 7.1) 之裝置
擷取連絡人相關資料
擷取日曆相關資料
樣本
1、示範如何擷取連絡人相關資料
ContactPictureConverter.cs
using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using Microsoft.Phone.UserData; using System.IO; using Microsoft.Phone; namespace Demo.ContactsAndCalendar { public class ContactPictureConverter : System.Windows.Data.IValueConverter { // 提取 Contact 中的圖片,將圖片轉換成 WriteableBitmap 類型對象並返回 public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Contact contact = value as Contact; if (contact == null) return null; // 將連絡人圖片轉換成 WriteableBitmap 類型的對象,並返回此對象 Stream imageStream = contact.GetPicture(); if (imageStream != null) return PictureDecoder.DecodeJpeg(imageStream); return null; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } }