今天更新的 SDK 现在支持条形码(以及更多更改)。SDK 也不再预览 woho!
新的:
- 丰富的内容图块——条形码和图标
- 项目清单
- 我们可以有按钮!(不敢相信我对按钮如此兴奋)
- 我们可以监听 tile 和 button 事件
- 访问新数据——卡路里
- Windows 手机后台支持
- iOS 远程或本地通知
这是上传的新示例应用程序中的一些条形码代码。
using (IBandClient bandClient = await BandClientManager.Instance.ConnectAsync(pairedBands[0]))
{
var myCardTextBlock = new TextBlock()
{
Color = Colors.Blue.ToBandColor(),
ElementId = 1,
Rect = new PageRect(0, 0, 200, 25)
};
var barcode = new Barcode(BarcodeType.Code39)
{
ElementId = 2,
Rect = new PageRect(0, 0, 250, 50)
};
TextBlock digitsTextBlock = new TextBlock()
{
ElementId = 3,
Rect = new PageRect(0, 0, 200, 25)
};
FlowPanel panel = new FlowPanel(myCardTextBlock, barcode, digitsTextBlock)
{
Orientation = FlowPanelOrientation.Vertical,
Rect = new PageRect(0, 0, 250, 100)
};
Guid myTileId = new Guid("D781F673-6D05-4D69-BCFF-EA7E706C3418");
BandTile myTile = new BandTile(myTileId)
{
Name = "My Tile",
TileIcon = await LoadIcon("ms-appx:///Assets/SampleTileIconLarge.png"),
SmallIcon = await LoadIcon("ms-appx:///Assets/SampleTileIconSmall.png")
};
myTile.PageLayouts.Add(new PageLayout(panel));
await bandClient.TileManager.AddTileAsync(myTile);
PageData page = new PageData(
Guid.NewGuid(),
0,
new TextBlockData(myCardTextBlock.ElementId.Value, "MY CARD"),
new BarcodeData(barcode.BarcodeType, barcode.ElementId.Value, "123456789"),
new TextBlockData(digitsTextBlock.ElementId.Value, "123456789"));
await bandClient.TileManager.SetPagesAsync(myTile.TileId, page);
this.viewModel.StatusMessage = "Done. Check the Tile on your Band (it's the last Tile).";
}