作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个使用本地 SqlCe 数据库的 Mango WP7.5 应用程序。我想添加一个 LiveTile 更新,显示基于当前日期和月份从本地数据库获取的信息。
我发现的所有示例都通过从服务器下载远程图像来更新背景,但我只需要进行本地数据库查询并在我的磁贴中显示一个字符串。
我可以做吗?如何?
最佳答案
是的你可以。你必须
isostore
访问它URI。 // 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 = "Hello\nWorld";
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, 0, 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);
}
}
关于windows-phone-7 - 我可以使用本地数据更新 Mango 中的动态磁贴吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8027812/
我在获取附加 Bootstrap 导航栏以在页面滚动时正确调整其宽度时遇到问题。 我希望导航栏在页面滚动时保持其包含元素内部的宽度,或者占据页面的整个宽度(从左到右开始) 我做错了什么,或者我需要做什
所以我正在尝试创建一个布局,其中我有一个带有卡片的页面,右侧有一张摘要卡片,在我滚动时会 float 。一种典型的词缀对象,以前在 bootstrap 中见过。到目前为止,这是我的尝试: 出于某种原因
我是一名优秀的程序员,十分优秀!