public async Task<bool> Pin(TileInfo tileInfo)
		{
			if (tileInfo == null)
			{
				throw new ArgumentNullException("tileInfo");
			}

			var isPinned = false;

			if (!SecondaryTile.Exists(tileInfo.TileId))
			{
				var secondaryTile = new SecondaryTile(
					tileInfo.TileId,
					tileInfo.ShortName,
					tileInfo.DisplayName,
					tileInfo.Arguments,
					tileInfo.TileOptions,
					tileInfo.LogoUri);

				if (tileInfo.WideLogoUri != null)
				{
					secondaryTile.WideLogo = tileInfo.WideLogoUri;
				}

				isPinned = await secondaryTile.RequestCreateForSelectionAsync(
						GetElementRect(tileInfo.AnchorElement), tileInfo.RequestPlacement);
			}

			return isPinned;
		}
		public async Task<bool> Pin(TileInfo tileInfo)
		{
			if (tileInfo == null)
			{
				throw new ArgumentNullException("tileInfo");
			}

			var isPinned = false;

			if (!SecondaryTile.Exists(tileInfo.TileId))
			{
				var secondaryTile = new SecondaryTile(
					tileInfo.TileId,
					tileInfo.DisplayName,
					tileInfo.Arguments,
					tileInfo.LogoUri,
					tileInfo.TileSize);

				if (tileInfo.WideLogoUri != null)
				{
					secondaryTile.VisualElements.Wide310x150Logo = tileInfo.WideLogoUri;
				}

				secondaryTile.VisualElements.ShowNameOnSquare150x150Logo = true;
				secondaryTile.VisualElements.ShowNameOnWide310x150Logo = true;
				secondaryTile.VisualElements.ShowNameOnSquare310x310Logo = true;

				isPinned = await secondaryTile.RequestCreateForSelectionAsync(
						GetElementRect(tileInfo.AnchorElement), tileInfo.RequestPlacement);
			}

			return isPinned;
		}
Exemple #3
0
        public Task<bool> Unpin(TileInfo tileInfo)
        {
            ShellTile tile = this.FindTile(tileInfo.TileId);
            if (tile != null)
            {
                tile.Delete();
            }

            return Task.FromResult<bool>(true);
        }
		public async Task<bool> Unpin(TileInfo tileInfo)
		{
			var wasUnpinned = false;

			if (SecondaryTile.Exists(tileInfo.TileId))
			{
				var secondaryTile = new SecondaryTile(tileInfo.TileId);
				wasUnpinned = await secondaryTile.RequestDeleteForSelectionAsync(
					GetElementRect(tileInfo.AnchorElement), tileInfo.RequestPlacement);
			}

			return wasUnpinned;
		}
Exemple #5
0
        public Task<bool> Pin(TileInfo tileInfo)
        {
            var result = false;
            if (!this.IsPinned(tileInfo.TileId))
            {
                var tileData = new StandardTileData
                {
                    Title = tileInfo.DisplayName,
                    BackgroundImage = tileInfo.LogoUri,
                    Count = tileInfo.Count,
                    BackTitle = tileInfo.AppName,
                    BackBackgroundImage = new Uri("", UriKind.Relative),
                    BackContent = tileInfo.DisplayName
                };

                ShellTile.Create(new Uri(tileInfo.TileId, UriKind.Relative), tileData);
                result = true;
            }

            return Task.FromResult<bool>(result);
        }