/// <summary> /// Unpins a secondary tile to the start screen. /// </summary> public async Task <bool> UnPinSecondaryTileAsync(IPinablePageControl pinnablePageControl) { var secondaryTile = (from tile in await SecondaryTile.FindAllAsync() where string.Equals(pinnablePageControl.TileId, tile.TileId, StringComparison.OrdinalIgnoreCase) select tile).FirstOrDefault(); if (secondaryTile != null) { if (await secondaryTile.RequestDeleteAsync()) { await pinnablePageControl.UpdateTileAsync(false); return(true); } } return(false); }
/// <summary> /// Pins a secondary tile to the start screen. /// </summary> public async Task<bool> PinSecondaryTileAsync(IPinablePageControl pinnablePageControl) { Uri logoUri = new Uri("ms-appx:///Assets/Logo.scale-100.png"); Uri smallLogoUri = new Uri("ms-appx:///Assets/SmallLogo.scale-100.png"); Uri wideLogoUri = new Uri("ms-appx:///Assets/WideLogo.scale-100.png"); Uri largeLogoUri = new Uri("ms-appx:///Assets/Square310x310Logo.scale-100.png"); SecondaryTile secondaryTile = new SecondaryTile(); secondaryTile.TileId = pinnablePageControl.TileId; secondaryTile.DisplayName = pinnablePageControl.TileName; secondaryTile.Arguments = pinnablePageControl.GetParameters().ToQueryString(); secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = true; secondaryTile.VisualElements.ShowNameOnWide310x150Logo = true; secondaryTile.VisualElements.ShowNameOnSquare310x310Logo = true; secondaryTile.VisualElements.Square30x30Logo = smallLogoUri; secondaryTile.VisualElements.Square150x150Logo = logoUri; secondaryTile.VisualElements.Wide310x150Logo = wideLogoUri; secondaryTile.VisualElements.Square310x310Logo = largeLogoUri; secondaryTile.VisualElements.ForegroundText = ForegroundText.Light; if (await secondaryTile.RequestCreateAsync()) { try { await pinnablePageControl.UpdateTileAsync(true); } catch { // In case of network error, don't bring down the app. Nothing we can do here... return false; } } return true; }
/// <summary> /// Pins a secondary tile to the start screen. /// </summary> public async Task <bool> PinSecondaryTileAsync(IPinablePageControl pinnablePageControl) { Uri logoUri = new Uri("ms-appx:///Assets/Logo.scale-100.png"); Uri smallLogoUri = new Uri("ms-appx:///Assets/SmallLogo.scale-100.png"); Uri wideLogoUri = new Uri("ms-appx:///Assets/WideLogo.scale-100.png"); Uri largeLogoUri = new Uri("ms-appx:///Assets/Square310x310Logo.scale-100.png"); SecondaryTile secondaryTile = new SecondaryTile(); secondaryTile.TileId = pinnablePageControl.TileId; secondaryTile.DisplayName = pinnablePageControl.TileName; secondaryTile.Arguments = pinnablePageControl.GetParameters().ToQueryString(); secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = true; secondaryTile.VisualElements.ShowNameOnWide310x150Logo = true; secondaryTile.VisualElements.ShowNameOnSquare310x310Logo = true; secondaryTile.VisualElements.Square30x30Logo = smallLogoUri; secondaryTile.VisualElements.Square150x150Logo = logoUri; secondaryTile.VisualElements.Wide310x150Logo = wideLogoUri; secondaryTile.VisualElements.Square310x310Logo = largeLogoUri; secondaryTile.VisualElements.ForegroundText = ForegroundText.Light; if (await secondaryTile.RequestCreateAsync()) { try { await pinnablePageControl.UpdateTileAsync(true); } catch { // In case of network error, don't bring down the app. Nothing we can do here... return(false); } } return(true); }
/// <summary> /// Unpins a secondary tile to the start screen. /// </summary> public async Task<bool> UnPinSecondaryTileAsync(IPinablePageControl pinnablePageControl) { var secondaryTile = (from tile in await SecondaryTile.FindAllAsync() where string.Equals(pinnablePageControl.TileId, tile.TileId, StringComparison.OrdinalIgnoreCase) select tile).FirstOrDefault(); if (secondaryTile != null) { if (await secondaryTile.RequestDeleteAsync()) { await pinnablePageControl.UpdateTileAsync(false); return true; } } return false; }