Music + Videos hub可以将Music或Video为主的程序集成到history、new和marquee中,当点击这些集成的图标,就可以打开相应的程序。据说YouTube就会以这样的形式出现在Phone7中。
放到History中:
1. Now Playing:
MediaHistoryItem mhi = new MediaHistoryItem();
mhi.Source = " ";
mhi.ImageStream = App.GetResourceStream(new Uri("Images/s.jpg", UriKind.Relative)).Stream;
mhi.Title = "Now Playing";
mhi.PlayerContext.Add("test1", "test2");
MediaHistory.Instance.NowPlaying = mhi;
2. Recent Playing:
MediaHistoryItem mhi = new MediaHistoryItem();
mhi.Source = " ";
mhi.ImageStream = App.GetResourceStream(new Uri("Images/s.jpg", UriKind.Relative)).Stream;
mhi.Title = "Recent Play";
mhi.PlayerContext.Add("test1", "aa");
MediaHistory.Instance.WriteRecentPlay(mhi);
放到new中:
MediaHistoryItem mhi = new MediaHistoryItem();
mhi.Source = " ";
mhi.ImageStream = App.GetResourceStream(new Uri("Images/s.jpg", UriKind.Relative)).Stream;
mhi.Title = "Recent Play";
mhi.PlayerContext.Add("test1", "aa");
MediaHistory.Instance.WriteAcquiredItem(mhi);
所集成的程序会自动放到Marquee列表下。
对Tile图的要求:
但是目前在模拟器上好像这个要求是不对的,因为ImageStream只允许ImageSize为16384,也就是16K左右,但是这个要求里最小的173*173pixels也比这个值大。不知道是不是因为是模拟器的缘故??
另外,在WMAppManifest.xml中加入属性:HubType="1",可以用于测试。