加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

microsoft-band – 很难创建Microsoft Band磁贴图标

发布时间:2020-12-14 05:44:46 所属栏目:Windows 来源:网络整理
导读:它在Microsoft Band SDK文档中说有关使用WriteableBitmap创建磁贴图标,但是如何让它指向我为Tile创建的现有图像? 解决方法 如果您的 Windows Phone应用程序具有名为“Assets / Icon1.png”的资产,则可以通过以下方式将该资产制作为BandIcon: using Microso
它在Microsoft Band SDK文档中说有关使用WriteableBitmap创建磁贴图标,但是如何让它指向我为Tile创建的现有图像?

解决方法

如果您的 Windows Phone应用程序具有名为“Assets / Icon1.png”的资产,则可以通过以下方式将该资产制作为BandIcon:

using Microsoft.Band;
using Microsoft.Band.Tiles;
using Microsoft.Band.Tiles.Pages;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media.Imaging;

StorageFile imageFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Assets/Icon1.png"));
using (IRandomAccessStream fileStream = await imageFile.OpenAsync(FileAccessMode.Read)
{
    WriteableBitmap bitmap = new WriteableBitmap(1,1);
    await bitmap.SetSourceAsync(fileStream);
    return bitmap.ToBandIcon();
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读