Windows Phone的瓷砖

来源:互联网 发布:java休眠1秒 编辑:程序博客网 时间:2024/03/29 19:11

Windows Phone的瓷砖

 

一个程序的超链接.

两种类型:程序Tile以及备用Tile<Phone7.1的新特性>.

三个更新方式:ShellTile APIs/PNS/SHellTileSchedule

 

 

Application Tile:

手工可以Pin产生,无须代码干预;

Secondary Tile:

程序代码Pin到Start,一个程序可以使用多个Secondary Tile,但只能有一个Application Tile.典型的场景包括天气预报/城市新闻/分类新闻,各分类均可以Pin到启动界面.

注意:

两类型的Tile,不存在任何依赖关系,看一下两者对比。

  

Tile type

   

Tile creation

   

Tile deletion

   

Tile update

   

Application Tile

   

Can be created by the  user only  when the user taps and holds the application name in the Application List and  then selectspin to start. Properties are initially set in the Application Manifest.   

   

Cannot  be deleted. The Application Tile may or may not be pinned to Start. But even  if the user has not pinned the Application Tile to Start, it can beupdated programmatically such  that its property data will be fresh should the user decide to pin it.

   

Can be updated by:

 

·          ShellTile  APIs. The Application Tile is always the first item in the ActiveTiles  collection, even if the Tile is not pinned to Start.

 

·          Push Notifications for Windows  Phone

 

·          ShellTileSchedule  APIs

   

Secondary Tiles

   

Can be created only as  the result of user input in an application. The application then uses theCreate(Uri, ShellTileData)  method to create a Tile on Start. Because the UI will navigate to Start when  a new secondary Tile is created,only one secondary Tile can be  created at a time.

   

Can be  deleted by:

 

1.        The user unpinning the Tile from Start.

 

2.        Uninstalling the application.

 

3.        Calling Delete.

   

Can be updated by:

 

·          ShellTile  APIs

 

·          Push Notifications for Windows  Phone

 

·          ShellTileSchedule  APIs

 

 

Tile属性:

从Phone 7.1之后,Tile具备两面Front/Back。如果Back没有任何的设置,Tile就不会自动翻转,可以通过程序设置:

正面

反面

注意:

创建Tile的Background/back-backgroud的图片必须使用本地资源,Image必须位于目录Shared\shellContent,更新时候可以使用本地或远程(Https是不支持的)的图片。

 

 

简单测试:

 

 

private void buttonIndefinite_Click(object sender,RoutedEventArgs e)

{

    // Updates willhappen on a fixed interval.

   SampleTileSchedule.Recurrence = UpdateRecurrence.Interval;

 

    // Updates willhappen every hour.  BecauseMaxUpdateCount is not set, the schedule will run indefinitely.

   SampleTileSchedule.Interval = UpdateInterval.EveryHour;

 

   SampleTileSchedule.RemoteImageUri = newUri(@"http://www.weather.gov/forecasts/graphical/images/conus/MaxT1_conus.png");

   SampleTileSchedule.Start();

   TileScheduleRunning = true;

}

//测试开始之后,需要等待一段时间才可以看到Tile图片的变化。

Whilethis sample does not have secondary Tiles, you can set up a schedule for a secondary Tile by passingthe Tile information to the ShellTileSchedule constructor. The sample belowdemonstrates how to set up a schedule for each existing 《Secondary》Tile.