Windows 8 Metro app Study Notes (9)-tile

Source: Internet
Author: User

Tile is the tile displayed on the desktop. The creation and lifecycle of the tile can be freely created by users and can directly access an application. It also brings a lot of convenience for timely information push. In Windows 8, The secondarytile object is responsible.

 

First, let's take a look at its attributes.:

Arguments: It displays some information customized by the Program on the desktop tile. This value can be used for processing when an app is activated through tile.

Backgroundcolor: The background color of tile.

Displayname: Similar to the prompt message. When the user moves to the tile, this information is displayed.

Foregroundtext: Font color, only dark and light

Logo: Logo icon, used when creating a square tile. This attribute is required when you create a square or full tile.

Shortname: The brief information is directly displayed on the desktop tile.

Smallogo: Small icon. This small icon is displayed in the query application result set.

Tileid: This is the unique identifier of a tile.

Tileoptions: Some options are specified when shortname is given, including four options (none, shownameonlogo, shownameonwidelogo, copyondeployment)

Widelogo: When creating a wide tile, set the image logo

 

I can't wait to try out how to pin it to the desktop. I have to construct a secondarytile object first.

 

We can select different constructors based on different needs.

I have read the create method.

 

 

No. The create and delete Methods correspond. The following describes the specific usage.

Uri logo = new Uri("ms-appx:///images/squareTile-sdk.png");Uri smallLogo = new Uri("ms-appx:///images/smallTile-sdk.png");           string tileActivationArguments = "timeTileWasPinned=" + DateTime.Now.ToLocalTime().ToString();           SecondaryTile secondaryTile = new SecondaryTile(MainPage.tileId, "Title Test",   
 "Name of the tile the user sees when searching for the tile",                                                     tileActivationArguments,                                   TileOptions.ShowNameOnLogo,logo);           secondaryTile.ForegroundText = ForegroundText.Dark;          secondaryTile.SmallLogo = smallLogo;          bool isPinned = await secondaryTile.RequestCreateForSelectionAsync(GetElementRect((FrameworkElement)sender), Windows.UI.Popups.Placement.Right);
 

See the following results:

 

Remove Tile

SecondaryTile secondaryTile = new SecondaryTile(MainPage.tileId);              bool isUnpinned = await secondaryTile.RequestDeleteForSelectionAsync(GetElementRect((FrameworkElement)sender), Windows.UI.Popups.Placement.Below);

No. There is a dialog like this during creation and removal, and shortname can be modified during create.

 

I can't help wondering where the navigateuri is. How can I reactivate the app from the desktop tile and jump to the page I specified ?? After carefully reading the msdn sample, the arguments above is of critical importance. The reason why the concept of navigateuri is not found here is that Win8 Metro app is not like Windows phone7, its Class Library does not have the concept of page navigate unless it is encapsulated by itself.

async protected override void OnLaunched(LaunchActivatedEventArgs args)        {                       Window.Current.Content = new MainPage(args.Arguments);            Window.Current.Activate();        }

 

When the app is enabled, it can receive the arguments value of the tile. With this value, we can perform logic processing or activate a page. Compared with Windows Phone 7, it gives us more space for free selection, isn't it ??

 

Secondarytile is also frequently used in two ways.

Exist (tileid ),Check whether there is a corresponding Tile

Findallasync ()Searches for all tile. This method also reloads multiple methods and returns the ireadonlylist <secondarytile> object.

 

This is the creation and removal of secondarytile. Its usage is relatively simple. Of course, the biggest advantage of using tile is that it can push information updates in a timely manner. This involves pushnotification usage ~ Then sort out...

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.