public async Task <bool> AddTileAsync(BandTile tile, CancellationToken token) { if (tile == null) { throw new ArgumentNullException("tile"); } if (string.IsNullOrWhiteSpace(tile.Name)) { throw new ArgumentException(BandResource.BandTileEmptyName, "tile"); } if (tile.SmallIcon == null) { throw new ArgumentException(BandResource.BandTileNoSmallIcon, "tile"); } if (tile.TileIcon == null) { throw new ArgumentException(BandResource.BandTileNoTileIcon, "tile"); } if (tile.AdditionalIcons.Count + 2 > _constants.BandTypeConstants.MaxIconsPerTile) { throw new ArgumentException(BandResource.BandTileTooManyIcons, "tile"); } if (tile.PageLayouts.Count > 5) { throw new ArgumentException(BandResource.BandTileTooManyTemplates, "tile"); } foreach (PageLayout layout in tile.PageLayouts) { if (layout == null) { throw new InvalidOperationException(BandResource.BandTileNullTemplateEncountered); } // TODO: add this back... //if (layout.GetSerializedByteCountAndValidate() > 768) //{ // throw new ArgumentException(BandResource.BandTilePageTemplateBlobTooBig); //} } await Task.Delay(500); // We will only run against one app so don't need much complexity here (would be nice at some // point to be able the client to be able to test against a pre-configured setup of app tiles // on the band though) // request consent from user (TODO: make this a configurable property). // generate application ID which identifies the application package //var package = System.Windows.ApplicationModel.Package.current; var appId = _appIdProvider.GetAppId(); // TODO: Fix this - all this to be configured // store that against the tile... var tr = new TileRepresentation(tile.ToTileData(_tiles.GetCount(), appId), null); _tiles.AddTile(tr); return(true); }
public static BandTile ToBandTile(this TileRepresentation representation) { return(new BandTile(representation.Data.AppID) { IsBadgingEnabled = ((TileSettings)representation.Data.SettingsMask).HasFlag(TileSettings.EnableBadging), IsScreenTimeoutDisabled = ((TileSettings)representation.Data.SettingsMask).HasFlag(TileSettings.ScreenTimeoutDisabled), Name = representation.Data.FriendlyName, TileIcon = representation.Icon }); }
public void AddTile(TileRepresentation tr) { _tiles.Add(tr); }