A difficult time creating the Microsoft Band icon

The Microsoft Band SDK documentation says how to use WriteableBitmap to create a thumbnail, but how do I do this to point to an existing image I made for Tile?

+3


source to share


1 answer


If your Windows Phone app has an asset named "Assets / Icon1.png", then that asset can be turned into a BandIcon, for example:

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();
}

      

+7


source







All Articles