Пример #1
0
        public static async Task <bool> CreateOrReplaceSecondaryTile(VLCItemType type, int id, string title)
        {
            string tileId = "SecondaryTile-" + type.ToString() + "-" + id;

            if (!SecondaryTile.Exists(tileId))
            {
                var tileData = new SecondaryTile()
                {
                    TileId      = tileId,
                    DisplayName = title,
                    Arguments   = tileId
                };
                string subfolder = null;
                switch (type)
                {
                case VLCItemType.Album:
                    subfolder = "albumPic";
                    break;

                case VLCItemType.Artist:
                    subfolder = "artistPic";
                    break;
                }
                tileData.VisualElements.ShowNameOnSquare150x150Logo = true;
                tileData.DisplayName = title;
                tileData.VisualElements.Square150x150Logo =
                    new Uri("ms-appdata:///local/" + subfolder + "/" + id + ".jpg");
                bool success = await tileData.RequestCreateAsync();

                return(success);
            }
            else
            {
                SecondaryTile secondaryTile = new SecondaryTile(tileId);
                await secondaryTile.RequestDeleteForSelectionAsync(Window.Current.Bounds, Placement.Default);

                ToastHelper.Basic(Strings.TileRemoved);
                return(false);
            }
        }
Пример #2
0
        public static bool SecondaryTileExists(VLCItemType type, int id, string title)
        {
            string tileId = "SecondaryTile-" + type.ToString() + "-" + id;

            return(SecondaryTile.Exists(tileId));
        }
Пример #3
0
 public static bool SecondaryTileExists(VLCItemType type, int id, string title)
 {
     string tileId = "SecondaryTile-" + type.ToString() + "-" + id;
     return SecondaryTile.Exists(tileId);
 }
Пример #4
0
 public static async void CreateOrReplaceSecondaryTile(VLCItemType type, int id, string title)
 {
     string tileId = "SecondaryTile-" + type.ToString() + "-" + id;
     if (!SecondaryTile.Exists(tileId))
     {
         var tileData = new SecondaryTile()
         {
             TileId = tileId,
             DisplayName = title,
             Arguments = tileId
         };
         string subfolder = null;
         switch (type)
         {
             case VLCItemType.Album:
                 subfolder = "albumPic";
                 break;
             case VLCItemType.Artist:
                 subfolder = "artistPic";
                 break;
         }
         tileData.VisualElements.ShowNameOnSquare150x150Logo = true;
         tileData.DisplayName = title;
         tileData.VisualElements.Square150x150Logo =
             new Uri("ms-appdata:///local/" + subfolder + "/" + id + ".jpg");
         await tileData.RequestCreateAsync();
     }
     else
     {
         SecondaryTile secondaryTile = new SecondaryTile(tileId);
         await secondaryTile.RequestDeleteForSelectionAsync(Window.Current.Bounds, Placement.Default);
         ToastHelper.Basic("Tile removed !");
     }
 }