Ejemplo n.º 1
0
        public async Task<bool> PinAsync(TileInfo info, string tileId, string arguments)
        {
            System.Diagnostics.Contracts.Contract.Requires(info != null, "TileInfo");
            System.Diagnostics.Contracts.Contract.Requires(!string.IsNullOrEmpty(tileId), "TileId");

            if (Exists(tileId))
            {
                var existings = await SecondaryTile.FindAllAsync();
                var existing = existings.FirstOrDefault(x => x.Arguments.Equals(arguments));
            }

            var tile = new SecondaryTile()
            {
                TileId = tileId,
                DisplayName = info.DisplayName,
                Arguments = arguments,
                PhoneticName = info.PhoneticName,
                LockScreenDisplayBadgeAndTileText = info.LockScreenDisplayBadgeAndTileText,
            };

            if (info.LockScreenBadgeLogo != null)
            {
                tile.LockScreenBadgeLogo = info.LockScreenBadgeLogo;
            }

            tile.VisualElements.BackgroundColor = info.VisualElements.BackgroundColor;
            tile.VisualElements.ForegroundText = info.VisualElements.ForegroundText;
            tile.VisualElements.ShowNameOnSquare150x150Logo = info.VisualElements.ShowNameOnSquare150x150Logo;
            tile.VisualElements.ShowNameOnSquare310x310Logo = info.VisualElements.ShowNameOnSquare310x310Logo;
            tile.VisualElements.ShowNameOnWide310x150Logo = info.VisualElements.ShowNameOnWide310x150Logo;

            if (info.VisualElements.Square150x150Logo != null)
            {
                tile.VisualElements.Square150x150Logo = info.VisualElements.Square150x150Logo;
            }

            if (info.VisualElements.Square30x30Logo != null)
            {
                tile.VisualElements.Square30x30Logo = info.VisualElements.Square30x30Logo;
            }

            if (info.VisualElements.Square310x310Logo != null)
            {
                tile.VisualElements.Square310x310Logo = info.VisualElements.Square310x310Logo;
            }

            if (info.VisualElements.Wide310x150Logo != null)
            {
                tile.VisualElements.Wide310x150Logo = info.VisualElements.Wide310x150Logo;
            }

            var result = await tile.RequestCreateForSelectionAsync(info.Rect(), info.RequestPlacement);
            return result;
        }
Ejemplo n.º 2
0
 public Task<bool> PinAsync(TileInfo info, string tileId, string arguments) => _helper.PinAsync(info, tileId, arguments);
Ejemplo n.º 3
0
 public Task <bool> PinAsync(TileInfo info, string tileId, string arguments)
 {
     return(_helper.PinAsync(info, tileId, arguments));
 }