WindowsPhone 7.8 Tiles 3 : 7.8的Tiles利器mangopollo
mangopollo:http://mangopollo.codeplex.com/
利用mangopollo可以让我们在7.8方便的创建live tiles…
Mangopollo will allow you to easily take advantage of new windows phone tiles (cyclic, flip, iconic) if your application is run from a Windows Phone 7.8 or 8 as well as new launchers if your application is run from a Windows Phone 8 while remaining compatible with windows phone 7.
安装mangopollo可以通过nuget
PM> Install-Package Mangopollo
还是来看使用效果吧
首先是判断:
//判断是否wp8private void TestIfWP8_Click(object sender, RoutedEventArgs e){if (Utils.IsWP8){MessageBox.Show("It's a Windows Phone 8 !");}else{MessageBox.Show("It's a Windows Phone 7 !");}}
//判断是否支持新的Tiles
private void TestIfWP78_Click(object sender, RoutedEventArgs e)
{
if (Utils.CanUseLiveTiles)
{
MessageBox.Show("It's a Windows Phone 7.8 or sup !");
}
else
{
MessageBox.Show("It's a Windows Phone 7 !");
}
}
创建CycleTile:
private void CreateCycleTile_Click(object sender, RoutedEventArgs e){if (!Utils.CanUseLiveTiles){MessageBox.Show("This feature needs Windows Phone 8");return;}try{var mytile = new CycleTileData{Title = "cyclic tile",Count = 42,SmallBackgroundImage = new Uri("/Assets/logo159x159.png", UriKind.Relative),CycleImages = new List<Uri> {new Uri("/Assets/Image1.png", UriKind.Relative), new Uri("/Assets/Image2.png", UriKind.Relative), new Uri("/Assets/Image3.png", UriKind.Relative)}};#if ALTERNATIVE_SOLUTIONvar mytile = Mangopollo.Tiles.TilesCreator.CreateCyclicTile("cyclic tile", 42, new Uri("/Assets/logo159x159.png", UriKind.Relative), new List<Uri>() { new Uri("/Assets/Image1.png", UriKind.Relative), new Uri("/Assets/Image2.png", UriKind.Relative), new Uri("/Assets/Image3.png", UriKind.Relative) });
#endifShellTileExt.Create(new Uri("/MainPage.xaml?msg=from%20cycle%20tile", UriKind.Relative), mytile, false);}catch{MessageBox.Show("remove tile before create it again");}}private void CreateCycleTileWide_Click(object sender, RoutedEventArgs e){if (!Utils.CanUseLiveTiles){MessageBox.Show("This feature needs Windows Phone 8");return;}try{var mytile = new CycleTileData{Title = "cyclic wide tile",Count = 42,SmallBackgroundImage = new Uri("/Assets/logo159x159.png", UriKind.Relative),CycleImages = new List<Uri> {new Uri("/Assets/Image1.png", UriKind.Relative), new Uri("/Assets/Image2.png", UriKind.Relative), new Uri("/Assets/Image3.png", UriKind.Relative)}};#if ALTERNATIVE_SOLUTIONvar mytile = Mangopollo.Tiles.TilesCreator.CreateCyclicTile("cyclic wide tile", 42, new Uri("/Assets/logo159x159.png", UriKind.Relative), new List<Uri>() { new Uri("/Assets/Image1.png", UriKind.Relative), new Uri("/Assets/Image2.png", UriKind.Relative), new Uri("/Assets/Image3.png", UriKind.Relative) });
#endifShellTileExt.Create(new Uri("/MainPage.xaml?msg=from%20wide%20cycle%20tile", UriKind.Relative), mytile, true);}catch{MessageBox.Show("remove tile before create it again");}}
效果:
创建IconicTile:
private void CreateIconicTile_Click(object sender, RoutedEventArgs e)
{
if (!Utils.CanUseLiveTiles)
{
MessageBox.Show("This feature needs Windows Phone 8");
return;
}
try
{
var mytile = new IconicTileData
{
Title = "iconic tile",
Count = 8,
BackgroundColor = Colors.Purple,
IconImage = new Uri("/Assets/logo202x202.png", UriKind.Relative),
SmallIconImage = new Uri("/Assets/logo110x110.png", UriKind.Relative)
};
#if ALTERNATIVE_SOLUTION
var mytile = Mangopollo.Tiles.TilesCreator.CreateIconicTile("iconic tile", 8, Colors.Purple, new Uri("/Assets/logo202x202.png", UriKind.Relative), new Uri("/Assets/logo110x110.png", UriKind.Relative));
#endif
ShellTileExt.Create(new Uri("/MainPage.xaml?msg=from%20iconic%20tile", UriKind.Relative), mytile, false);
}
catch
{
MessageBox.Show("remove tile before create it again");
}
}
private void CreateIconicTileWide_Click(object sender, RoutedEventArgs e)
{
if (!Utils.CanUseLiveTiles)
{
MessageBox.Show("This feature needs Windows Phone 8");
return;
}
try
{
var mytile = new IconicTileData
{
Title = "iconic tile",
Count = 8,
BackgroundColor = Color.FromArgb(255, 200, 10, 30),
IconImage = new Uri("/Assets/logo202x202.png", UriKind.Relative),
SmallIconImage = new Uri("/Assets/logo110x110.png", UriKind.Relative),
WideContent1 = "Mangopollo Library",
WideContent2 = "use Windows Phone 8 features",
WideContent3 = "on Windows Phone 7 apps"
};
#if ALTERNATIVE_SOLUTION
var mytile = Mangopollo.Tiles.TilesCreator.CreateIconicTile("iconic wide tile", 8, Colors.Gray, new Uri("/Assets/logo202x202.png", UriKind.Relative), new Uri("/Assets/logo110x110.png", UriKind.Relative), "Mangopollo Library", "created by", "Rudy Huyn");
#endif
ShellTileExt.Create(new Uri("/MainPage.xaml?msg=from%20wide%20iconic%20tile", UriKind.Relative), mytile, true);
}
catch
{
MessageBox.Show("remove tile before create it again");
}
}
效果:
创建FlipTile:
private void CreateFlipTile_Click(object sender, RoutedEventArgs e)
{
if (!Utils.CanUseLiveTiles)
{
MessageBox.Show("This feature needs Windows Phone 8");
return;
}
try
{
var mytile = new FlipTileData
{
Title = "wide flip tile",
BackTitle = "created by",
BackContent = "Rudy Huyn",
Count = 9,
SmallBackgroundImage = new Uri("/Assets/logo159x159.png", UriKind.Relative),
BackgroundImage = new Uri("/Assets/Background336x336_1.png", UriKind.Relative),
BackBackgroundImage = new Uri("/Assets/Background336x336_2.png", UriKind.Relative)
};
#if ALTERNATIVE_SOLUTION
var mytile = Mangopollo.Tiles.TilesCreator.CreateFlipTile("wide flip tile", "created by", "Rudy Huyn", 9, new Uri("/Assets/logo159x159.png", UriKind.Relative), new Uri("/Assets/Background336x336_1.png", UriKind.Relative), new Uri("/Assets/Background336x336_2.png", UriKind.Relative));
#endif
ShellTileExt.Create(new Uri("/MainPage.xaml?msg=from%20flip%20tile", UriKind.Relative), mytile, false);
}
catch
{
MessageBox.Show("remove tile before create it again");
}
}
private void CreateFlipTileWide_Click(object sender, RoutedEventArgs e)
{
if (!Utils.CanUseLiveTiles)
{
MessageBox.Show("This feature needs Windows Phone 8");
return;
}
try
{
var mytile = new FlipTileData
{
Title = "wide flip tile",
BackTitle = "created by",
BackContent = "Rudy Huyn",
Count = 9,
SmallBackgroundImage = new Uri("/Assets/logo159x159.png", UriKind.Relative),
BackgroundImage = new Uri("/Assets/Background336x336_1.png", UriKind.Relative),
BackBackgroundImage = new Uri("/Assets/Background336x336_2.png", UriKind.Relative),
WideBackContent = "This is a very long long text to demonstrate the back content of a wide flip tile",
WideBackgroundImage = new Uri("/Assets/Background691x336_1.png", UriKind.Relative),
WideBackBackgroundImage = new Uri("/Assets/Background691x336_2.png", UriKind.Relative)
};
#if ALTERNATIVE_SOLUTION
var mytile = Mangopollo.Tiles.TilesCreator.CreateFlipTile("flip tile", "created by", "Rudy Huyn", "This is a very long long text to demonstrate the back content of a wide flip tile", 9, new Uri("/Assets/logo159x159.png", UriKind.Relative), new Uri("/Assets/Background336x336_1.png", UriKind.Relative), new Uri("/Assets/Background336x336_2.png", UriKind.Relative), new Uri("/Assets/Background691x336_1.png", UriKind.Relative), new Uri("/Assets/Background691x336_2.png", UriKind.Relative));
#endif
ShellTileExt.Create(new Uri("/MainPage.xaml?msg=from%20wipe%20flip%20tile", UriKind.Relative), mytile, true);
}
catch
{
MessageBox.Show("remove tile before create it again");
}
}
效果:
更新主Tile:
private void UpdateMainTile_Click(object sender, RoutedEventArgs e)
{
if (!Utils.CanUseLiveTiles)
{
MessageBox.Show("This feature needs Windows Phone 8");
return;
}
var maintile = new FlipTileData
{
Title = "main tile",
BackTitle = "this is",
BackContent = "main tile",
Count = 3,
SmallBackgroundImage = new Uri("/Assets/logo159x159.png", UriKind.Relative),
BackgroundImage = new Uri("/Assets/Background336x336_2.png", UriKind.Relative),
BackBackgroundImage = new Uri("/Assets/Background336x336_1.png", UriKind.Relative),
WideBackContent = "This is a very long long text to demonstrate the back content of a wide flip tile",
WideBackgroundImage = new Uri("/Assets/Background691x336_2.png", UriKind.Relative),
WideBackBackgroundImage = new Uri("/Assets/Background691x336_1.png", UriKind.Relative)
};
#if ALTERNATIVE_SOLUTION
var maintile = Mangopollo.Tiles.TilesCreator.CreateFlipTile("main tile", "This is", "main tile", "This is a very long long text to demonstrate the back content of a wide flip tile", 9, new Uri("/Assets/logo159x159.png", UriKind.Relative), new Uri("/Assets/Background336x336_1.png", UriKind.Relative), new Uri("/Assets/Background336x336_2.png", UriKind.Relative), new Uri("/Assets/Background691x336_1.png", UriKind.Relative), new Uri("/Assets/Background691x336_2.png", UriKind.Relative));
#endif
ShellTile.ActiveTiles.First().Update(maintile);
}
效果:
本文转自 sun8134 博客园博客,原文链接: http://www.cnblogs.com/sun8134/archive/2013/02/10/2909865.html ,如需转载请自行联系原作者
http://www.cnblogs.com/sun8134/archive/2013/02/10/2909865.html
WindowsPhone 7.8 Tiles 3 : 7.8的Tiles利器mangopollo相关推荐
- SpringMVC集成Tiles布局引擎框架
Tiles布局框架, http://tiles.apache.org/ Spring已经对Tiles进行了集成.页头页尾公共模板页要靠这个,不然重复代码太多. <dependency>&l ...
- Apache Tiles 学习(四)、Tiles实战
为什么80%的码农都做不了架构师?>>> 1.创建maven项目 New-->Maven Project--> 勾选上Create a simple project ...
- 掌握Tiles框架 (二)-- Tiles布局和定义
1. Tile 布局 构建第一个 tile 布局 如果站点能够重用相同的布局(使用 HTML 表格来实现)和图像,而不必重复相同的 HTML 代码,这样不是很好吗? Tile 在为站点创建共同的外观方 ...
- Tiles Framework
tiles framework 详解tiles framework 详解 就是一个页面模版引擎.可以渲染页面,属于视图层. 下面给你拷贝一份详细的tiles介绍,你可以初步了解一下. Tiles框架特 ...
- 教你搭建Tiles工程-HelloTiles(附源码)
1. 添加Tiles的jar依赖 <dependency><groupId>org.apache.tiles</groupId><artifactId> ...
- struts -Tiles介绍
來源:http://hithoper.blog.hexun.com/17860631_d.html 安装和配置Tiles 在您能够使用Tiles 框架之前,您必须确保它已安装并正确的配置在web容器中 ...
- 9.struts1.x中tiles框架的使用
在页面直接使用titles标签 先引入标签:<%@taglib uri="http://struts.apache.org/tags-tiles" prefix=" ...
- spring tiles_Spring MVC 3模板和Apache Tiles
spring tiles 对于任何Web应用程序,有效的设计考虑因素是使用模板引擎(或工具),并且由于具有Spring的"可插拔"特性,集成模板机制(例如Apache Tiles) ...
- Spring MVC 3模板和Apache Tiles
对于任何Web应用程序而言,有效的设计考虑因素是使用模板引擎(或工具),并且由于具有Spring的"可插拔"特性,因此集成模板机制(例如Apache Tiles)的确要容易得多. ...
最新文章
- java批量生成订单号_【笔记6-支付及订单模块】从0开始 独立完成企业级Java电商网站开发(服务端)...
- php的 each()用法,PHP each()用法及代码示例
- 06链队列_LinkQueue--(栈与队列)
- 百度打造AIR智能道路系统,可降低90%交通事故
- 因涉及微信小游戏“欢乐斗地主”不正当竞争纠纷 腾讯获途游游戏赔偿56万元...
- sybase linux下创建备份服务器,Sybase数据库备份方案
- python实现指纹识别毕业论文_指纹识别算法实现本科毕业论文
- 体系结构复习2——指令级并行(分支预测和VLIW)
- 最全ListView扩展的实例和补充
- 使用addClass和removeClass完成内容切换
- 2654 最小距离最大
- MySQL常用SQL(含复杂SQL查询)
- C++学习笔记——第三天运算符和表达式
- 解决OpenCV读取图片慢的方案
- 张量学习(6):张量代数
- 力矩传感器使用特别注意事项有哪些?
- android电视 美剧,天天美剧电视tv版apk
- 读《活在网络里 大升级时代的人类新进化》
- 【数据分析学习笔记day25】实战案例:世界高峰数据可视化+世界高峰数据可视化 (World's Highest Mountains)
- 占地2000亩!这所985高校国际校区开建
热门文章
- 怎么看到方法内引用方法的注释_开门就看到餐厅,玄关怎么设计?试试这3个方法,专为小户型设计...
- 四节传送带plc梯形图_自动控制系统的大脑--PLC
- 七牛上传图片html,使用七牛云上传图片
- usb打印机命令_打印机脱机怎么办 打印机脱机解决方法【详解】
- 城镇开发边界划定指南_URP精编 | 基于 “双评价”的城镇开发边界划定实证研究...
- php ip to int_ip地址和int相互转换
- 【阿里云课程】详解深度学习优化:参数初始化,激活函数,标准化,池化
- 全球与中国文件夹架市场研究与商业模式创新分析报告2022-2028年
- 乡村振兴谋定齐鲁道路-农业大健康·李昌平:放权改革创新
- openlayers基础(一)——Map