public async Task <bool> UpdateAsync(string tileId, SecondaryTileModel tileModel) { if (!Exists(tileId)) { return(false); } var tile = await GetSecondaryTileAsync(tileId); // update tile tile = UpdateSecondaryTileFromInfos(tile, tileModel); return(await tile.UpdateAsync()); }
public async Task <bool> PinForSelectionAsync(string tileId, SecondaryTileModel tileModel, string arguments = "") { if (Exists(tileId)) { return(false); } var tile = new SecondaryTile(tileId) { Arguments = arguments }; tile = UpdateSecondaryTileFromInfos(tile, tileModel); var result = await tile.RequestCreateForSelectionAsync(tileModel.Rect(), tileModel.RequestPlacement); return(result); }
private static SecondaryTile UpdateSecondaryTileFromInfos(SecondaryTile tile, SecondaryTileModel tileModel) { if (tileModel.DisplayName != null) { tile.DisplayName = tileModel.DisplayName; } if (tileModel.PhoneticName != null) { tile.PhoneticName = tileModel.PhoneticName; } if (tileModel.LockScreenDisplayBadgeAndTileText.HasValue) { tile.LockScreenDisplayBadgeAndTileText = tileModel.LockScreenDisplayBadgeAndTileText.Value; } if (tileModel.LockScreenBadgeLogo != null) { tile.LockScreenBadgeLogo = tileModel.LockScreenBadgeLogo; } if (tileModel.VisualElements.BackgroundColor.HasValue) { tile.VisualElements.BackgroundColor = tileModel.VisualElements.BackgroundColor.Value; } if (tileModel.VisualElements.ForegroundText.HasValue) { tile.VisualElements.ForegroundText = tileModel.VisualElements.ForegroundText.Value; } if (tileModel.VisualElements.ShowNameOnSquare150x150Logo.HasValue) { tile.VisualElements.ShowNameOnSquare150x150Logo = tileModel.VisualElements.ShowNameOnSquare150x150Logo.Value; } if (tileModel.VisualElements.ShowNameOnSquare310x310Logo.HasValue) { tile.VisualElements.ShowNameOnSquare310x310Logo = tileModel.VisualElements.ShowNameOnSquare310x310Logo.Value; } if (tileModel.VisualElements.ShowNameOnWide310x150Logo.HasValue) { tile.VisualElements.ShowNameOnWide310x150Logo = tileModel.VisualElements.ShowNameOnWide310x150Logo.Value; } if (tileModel.VisualElements.Square150x150Logo != null) { tile.VisualElements.Square150x150Logo = tileModel.VisualElements.Square150x150Logo; } if (tileModel.VisualElements.Square310x310Logo != null) { tile.VisualElements.Square310x310Logo = tileModel.VisualElements.Square310x310Logo; } if (tileModel.VisualElements.Wide310x150Logo != null) { tile.VisualElements.Wide310x150Logo = tileModel.VisualElements.Wide310x150Logo; } return(tile); }