惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
云风的 BLOG
云风的 BLOG
V
V2EX
The GitHub Blog
The GitHub Blog
T
Threatpost
Microsoft Azure Blog
Microsoft Azure Blog
Security Latest
Security Latest
A
Arctic Wolf
Google DeepMind News
Google DeepMind News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
P
Proofpoint News Feed
W
WeLiveSecurity
Cloudbric
Cloudbric
C
Check Point Blog
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
T
The Exploit Database - CXSecurity.com
U
Unit 42
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
PCI Perspectives
PCI Perspectives
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Spread Privacy
Spread Privacy
Hugging Face - Blog
Hugging Face - Blog
O
OpenAI News
N
News and Events Feed by Topic
The Last Watchdog
The Last Watchdog
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Privacy & Cybersecurity Law Blog
T
Threat Research - Cisco Blogs
博客园 - 聂微东
V
Visual Studio Blog
美团技术团队
Security Archives - TechRepublic
Security Archives - TechRepublic
G
GRAHAM CLULEY
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
CERT Recently Published Vulnerability Notes
Know Your Adversary
Know Your Adversary
小众软件
小众软件
Engineering at Meta
Engineering at Meta
NISL@THU
NISL@THU
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
人人都是产品经理
人人都是产品经理
Cisco Talos Blog
Cisco Talos Blog
Martin Fowler
Martin Fowler
T
Troy Hunt's Blog

博客园 - my favorite

【转】QT样式表 (QStyleSheet) 【转】Qt事件循环与线程 二 [转]Qt 智能指针学习 【转】Android Web Server 【转】Android Http Server Java Annotation 注释语法 android中json的序列化与反序列化 JavaScript定义类的几种方式 js获取浏览器高度和宽度值(多浏览器) Setting up SSL made easy… Better, Faster, Easier SSL testing for ASP.NET MVC & WebForms ASP.NET MVC 3 Internationalization Windows 8 学习笔记(十四)--.map文件与.kml文件的解析 Windows 8学习笔记(十二)--集合控件 Windows 8 学习笔记(十三)--生命周期 Windows 8学习笔记(十一)---图片的显示与保存 Windows 8学习笔记(十)----Notification Windows 8 学习笔记(八)--各种流之间的转换 Windows 8学习笔记(七)--Input输入设备
Windows 8 Metro App学习笔记(九)—磁砖
my favorite · 2012-07-03 · via 博客园 - my favorite

瓷砖,即桌面显示的Tile,它的创建和生命周期都可以由用户自由创建并可以直接访问一个应用程序,还可以为信息的及时推送带来很多的方便。在Windows 8中,由SecondaryTile对象负责。

首先了解一下它的属性

Arguments:它是显示在桌面Tile上程序定制的一些信息,当通过Tile激活一个APP时,可以用该值作一些处理

BackgroundColor:Tile的背景颜色

DisplayName:类似提示信息,当用户移到该Tile时,这个信息会显示

ForegroundText:字体颜色,只有Dark和Light两种

Logo:Logo图标,当创建一个方形的瓷砖中使用的标志形象。当你创建一个正方形或全瓷砖时,这个属性是必需的

ShortName:这个简短信息是直接显示在桌面Tile上的

SmalLogo:小图标,在查询应用程序结果集中,就显示该小图标

TileId:这是一个标识瓷砖的唯一标识

TileOptions:当给予ShortName时去指定一些选项,其包括四个选项(None,ShowNameOnLogo,ShowNameOnWideLogo,CopyOnDeployment)

WideLogo:在创建宽的Tile时,设置图片Logo

迫不及待想试一下到底怎么Pin到桌面了,得先构造一个SecondaryTile对象

image

我们可以根据不同的需求选择不同的构造函数

看了一下Create方法,哦,还真多

image

发现没,Create与Delete方法是对应的,下面了解一下具体的用法

"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);

看下效果:

image

移除Tile

SecondaryTile secondaryTile = new SecondaryTile(MainPage.tileId);             

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

发现没有,创建和移除时都会有一个对话似的那种,Create时还可以修改ShortName。

写的这里不禁有些疑惑,这里的NavigateUri哪里去了,当我从桌面Tile怎么重新激活APP,并跳转到我指定的页面呢??仔细看 了一下MSDN的Sample,原来我们上面的Arguments就是至关重要所在,之所以这里没有NavigateUri的概念,是因为Win8 Metro App不像Windows Phone7,它类库没有Page的Navigate概念,除非自己封装。

async protected override void OnLaunched(LaunchActivatedEventArgs args)

        {          

            Window.Current.Content = new MainPage(args.Arguments);

            Window.Current.Activate();

        }

APP 开启时,可以接收到Tile的Arguments值,通过该值我们可以去作逻辑处理,或激活某个页面,相比Windows Phone 7,给了我们更大的自由选配的空间,不是么??

SecondaryTile还有两个方法也经常用法

Exist(TileId),顾名思义,检测是否存在对应的Tile

FindAllAsync() 查找所有的Tile,该方法也重载了多个方法,返回的是IReadOnlyList<SecondaryTile>对象

这就是SecondaryTile的创建与移除,用法相对简单,当然我们使用Tile的最大好处是可以实现信息更新及时推送,这就涉及到PushNotification的用法了,先研究下~随后整理…

Trackback:

http://www.cnblogs.com/jing870812/archive/2012/04/16/2452658.html