windows-phone-7 – 我可以使用本地数据更新Mango中的实时图块吗
发布时间:2020-12-14 03:57:56 所属栏目:Windows 来源:网络整理
导读:我有一个使用本地SqlCe数据库的Mango WP7.5应用程序.我想添加一个LiveTile更新,显示根据当前日期和月份从本地数据库中获取的信息. 我发现的所有样本都通过从服务器下载远程图像来更新后台,但我只需要进行本地数据库查询并在我的磁贴中显示一个字符串. 我可以
我有一个使用本地SqlCe数据库的Mango WP7.5应用程序.我想添加一个LiveTile更新,显示根据当前日期和月份从本地数据库中获取的信息.
我发现的所有样本都通过从服务器下载远程图像来更新后台,但我只需要进行本地数据库查询并在我的磁贴中显示一个字符串. 我可以做吗?怎么样? 解决方法
是的你可以.你必须
>生成包含文本信息的图像 这是代码显示如何执行此操作(它更新应用程序平铺): // set properties of the Application Tile private void button1_Click(object sender,RoutedEventArgs e) { // Application Tile is always the first Tile,even if it is not pinned to Start ShellTile TileToFind = ShellTile.ActiveTiles.First(); // Application Tile should always be found if (TileToFind != null) { // create bitmap to write text to WriteableBitmap wbmp = new WriteableBitmap(173,173); TextBlock text = new TextBlock() { FontSize = (double)Resources["PhoneFontSizeExtraLarge"],Foreground = new SolidColorBrush(Colors.White) }; // your text from database goes here: text.Text = "HellonWorld"; wbmp.Render(text,new TranslateTransform() { Y = 20 }); wbmp.Invalidate(); // save image to isolated storage using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { // use of "/Shared/ShellContent/" folder is mandatory! using (IsolatedStorageFileStream imageStream = new IsolatedStorageFileStream("/Shared/ShellContent/MyImage.jpg",System.IO.FileMode.Create,isf)) { wbmp.SaveJpeg(imageStream,wbmp.PixelWidth,wbmp.PixelHeight,100); } } StandardTileData NewTileData = new StandardTileData { Title = "Title",// reference saved image via isostore URI BackgroundImage = new Uri("isostore:/Shared/ShellContent/MyImage.jpg",UriKind.Absolute),}; // update the Application Tile TileToFind.Update(NewTileData); } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 不使用StrCmpLogicalW或shlwapi.dll以数字和字母顺序(如Win
- windows – 是否可以从另一个进程捕获渲染音频会话?
- windows-server-2003,Windows服务器,命令行下载实用程序,ht
- 使用IE9在Windows 7上运行watir-webdriver时出现问题
- 我应该考虑在Windows上保护SVN?
- Windows – c/cli DLL在Win 8.1下失败
- Windows / .NET方式监控/调试串口?
- 如何通过cmd命令远程重启或远程关闭Windows服务器
- windows-xp – 当浏览器不支持SNI时会发生什么
- windows-7 – 为什么我的项目图标在Windows 7中看起来如此可
推荐文章
站长推荐
- Windows – Internet Explorer – SID S-1-5-5-0
- WP7:无法在对WCF服务的异步调用中捕获FaultExce
- windows – 如何以编程方式启用“允许此设备唤醒
- 将Windows中的蓝牙设备与c配对
- windows-xp – Windows“运行方式”,不知道密码
- .net – AForge.Video.FFMPEG.dll中发生AccessVi
- windows – 如何在控制台程序中为DirectSound Se
- 在非Qt应用程序中使用基于Qt的DLL
- windows – 使用vbscript激活(带到前台)特定窗口
- 在没有uint8_t数据类型的MCU上使用uint8_t进行结
热点阅读