Windows Phone 8.1 Tiles, notifications and Action Center

Source: Internet
Author: User

(1) Tiles

Tiles, which is a tile, is a feature of Windows Phone.

A Tile can actually be seen as an XML, such as:

<Tile>  <Visual>    <bindingTemplate= "Tilesquareimage">      <ImageID= "1"src= "Image1"alt= "alt text"/>    </binding>    </Visual></Tile><Tile>  <Visualversion= "2">    <bindingTemplate= "Tilesquare150x150image"fallback= "Tilesquareimage">      <ImageID= "1"src= "Image1"alt= "alt text"/>    </binding>    </Visual></Tile>

Microsoft has provided us with a series of templates that can be referenced by: links

Tile can be easily updated as long as it is based on the XML format of the template:

Private voidUpdatebutton_click (Objectsender, RoutedEventArgs e) {Updatetiles ("Ms-appx:///images/middle.png","Ms-appx:///images/wide.png");}Private voidUpdatetiles (stringMiddlepath,stringWidepath) {    stringTilestring ="<tile>"+"<visual version=\ "2\" >"+"<binding template=\ "tilesquare150x150peekimageandtext04\" fallback=\ "tilesquarepeekimageandtext04\" > "+"<image id=\ "1\" src=\ ""+ Middlepath +"\ "alt=\" alt text\ "/>"+"<text id=\ "1\" ></text>"+"</binding>"+"<binding template=\ "tilewide310x150imageandtext01\" fallback=\ "tilewideimageandtext01\" >"+"<image id=\ "1\" src=\ ""+ Widepath +"\ "alt=\" alt text\ "/>"+"<text id=\ "1\" ></text>"+"</binding>"+"</visual>"+"</tile>"; XmlDocument Tilexml=NewXmlDocument ();    Tilexml.loadxml (tilestring); Tilenotification Newtile=Newtilenotification (Tilexml); Tileupdater Updater=tileupdatemanager.createtileupdaterforapplication (); Updater. Enablenotificationqueue (false); Updater. Update (newtile);}

In addition to the main tile we can also create a new secondarytile:

Private voidCreatebutton_click (Objectsender, RoutedEventArgs e) {Createtile ("Ms-appx:///images/middle.png","Ms-appx:///images/wide.png");}Private Async voidCreatetile (stringMiddlepath,stringWidepath) {Secondarytile Tile=NewSecondarytile ("Cortana","Cortana","Some",NewUri (Middlepath), tilesize.default); Tile. Visualelements.shownameonsquare150x150logo=true; Tile. Visualelements.foregroundtext=Foregroundtext.dark; Tile. Visualelements.square30x30logo=NewUri (Middlepath); Tile. Visualelements.wide310x150logo=NewUri (Widepath); awaitTile. Requestcreateasync ();}

The secondarytile update is the same as the primary tile update:

Tileupdater update = Tileupdatemanager.createtileupdaterforsecondarytile ("Cortana");

(2) Notifications

Notification (push notification) is divided into Tile,badge,toast,raw four types, and the method of notification is divided into Scheduled,periodic,local,push four kinds, the corresponding relationship between them is:

The use of the method is similar, the Update method can be called according to the respective XML format modification, for example:

XmlDocument xml =new= toastnotificationmanager.createtoastnotifier (); notifier. Show (toast);

Note that: (1) The TOAST notification needs to be licensed in Manifest; (2) The Push method is:

 private  async   Sendrawnotification () { var  channel = await   channel_pushnotificationreceived;}  private  void   channel_pushnotificationreceived (Pushnotificationchannel sender, Pushnotificationreceivedeventargs args) { var  raw = args. rawnotification;}  

(3) Action Center

1) Each app can host up to 20 notifications in Action Center

2) notifications can reside for up to 7 days

3) can send silent notifications (users are not prompted)

true;

4) notifications can be grouped

XmlDocument xml =new"one""1  ";

5) can update or delete notifications (you can delete a group)

ToastNotificationManager.History.RemoveGroup ("one");

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.