8.0 新的啟動器: ShareMediaTask, SaveAppointmentTask, MapsTask, MapsDirectionsTask, MapDownloaderTask
介紹
與眾不同 windows phone 8.0 之 新的啟動器
ShareMediaTask - 共用媒體檔案
ShareMediaTask - 建立“約會”到“日曆”
MapsTask - Nokia 地圖
MapsDirectionsTask - Nokia 地圖行車路線
MapDownloaderTask - 管理 Nokia 離線地圖
樣本
1、示範 ShareMediaTask - 共用媒體檔案
Launchers/ShareMediaTaskDemo.xaml
<phone:PhoneApplicationPage x:Class="Demo.Launchers.ShareMediaTaskDemo" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" mc:Ignorable="d" shell:SystemTray.IsVisible="True"> <StackPanel> <TextBlock Name="lblMsg" TextWrapping="Wrap" /> <Button Name="btnDemo" Content="Demo" Click="btnDemo_Click" /> </StackPanel> </phone:PhoneApplicationPage>
Launchers/ShareMediaTaskDemo.xaml.cs
/* * ShareMediaTask - 共用媒體檔案 * FilePath - 需要共用的媒體檔案的地址 * Show() - 彈出共用對話方塊(包含很多 provider,選擇一個以共用媒體檔案) */ using System.Windows;using Microsoft.Phone.Controls;using Microsoft.Phone.Tasks; namespace Demo.Launchers{ public partial class ShareMediaTaskDemo : PhoneApplicationPage { public ShareMediaTaskDemo() { InitializeComponent(); } private void btnDemo_Click(object sender, RoutedEventArgs e) { // 選擇一個圖片 PhotoChooserTask photoChooserTask = new PhotoChooserTask(); photoChooserTask.ShowCamera = true; photoChooserTask.Completed += photoChooserTask_Completed; photoChooserTask.Show(); } void photoChooserTask_Completed(object sender, PhotoResult e) { lblMsg.Text = "檔案地址:" + e.OriginalFileName; // 彈出共用對話方塊,從中選擇一個 provider 以共用媒體檔案 ShareMediaTask shareMediaTask = new ShareMediaTask(); shareMediaTask.FilePath = e.OriginalFileName; shareMediaTask.Show(); } }}