private static void UpdateTile(IAnimeData entry, Uri imgUri, Uri wideImgUri, PinTileSettings settings)
        {
            //scaryy...
            StringBuilder tileXmlString = new StringBuilder();

            tileXmlString.Append("<tile>");
            tileXmlString.Append($"<visual version='3' {(settings.AddBranding ? "branding='nameAndLogo'" : "")}>");
            tileXmlString.Append("<binding template='TileSquare150x150PeekImageAndText01' fallback='TileSquarePeekImageAndText01'>");
            if (settings.AddImage)
            {
                tileXmlString.Append($"<image id=\"1\" src=\"{imgUri}\"/>");
            }
            if (settings.AddTitle)
            {
                tileXmlString.Append($"<text hint-style=\"subtitle\" hint-wrap=\"true\" hint-maxLines=\"{(settings.BigTitle ? "2" : "1")}\" id=\"1\">{entry.Title}</text>");
            }
            if (settings.AddStatus)
            {
                tileXmlString.Append($"<text hint-style=\"caption\" hint-wrap=\"false\" id=\"2\">{(AnimeStatus)entry.MyStatus}</text>");
            }
            if (settings.AddScore)
            {
                tileXmlString.Append($"<text hint-style=\"caption\" id=\"3\">{(entry.MyScore == 0 ? "Unranked" : entry.MyScore + $"/{(Settings.SelectedApiType == ApiType.Mal ? "10" : "5")}")}{(settings.AddWatched ? " - " + entry.MyEpisodes + $"/{(entry.AllEpisodes == 0 ? "?" : entry.AllEpisodes.ToString())}" : "")}</text>");
            }
            if (settings.AddAirDay && entry is AnimeItemViewModel && ((AnimeItemViewModel)entry).TopLeftInfoBind != "")
            {
                tileXmlString.Append($"<text hint-style=\"caption\" id=\"4\">\n{((AnimeItemViewModel)entry).TopLeftInfoBind}</text>");
            }
            tileXmlString.Append("</binding>");
            tileXmlString.Append("<binding template='TileWide310x150ImageAndText02' fallback='TileWideImageAndText02'>");
            if (settings.AddImage)
            {
                tileXmlString.Append($"<image id=\"1\" src=\"{wideImgUri}\"/>");
            }
            if (settings.AddTitle)
            {
                tileXmlString.Append($"<text hint-style=\"title\" hint-maxLines=\"{(settings.BigTitle ? "2" : "1")}\" id=\"1\">{entry.Title}</text>");
            }
            tileXmlString.Append("<text id=\"2\"  hint-style=\"body\">");
            if (settings.AddStatus)
            {
                tileXmlString.Append($"{(AnimeStatus)entry.MyStatus}{(settings.AddWatched ? " - " + entry.MyEpisodes + $"/{(entry.AllEpisodes == 0 ? "?" : entry.AllEpisodes.ToString())}" : "")}");
            }
            if (settings.AddScore)
            {
                tileXmlString.Append($"\n{(entry.MyScore == 0 ? "Unranked" : entry.MyScore + $"/{(Settings.SelectedApiType == ApiType.Mal ? "10" : "5")}")}");
            }
            if (settings.AddAirDay && entry is AnimeItemViewModel && ((AnimeItemViewModel)entry).TopLeftInfoBind != "")
            {
                tileXmlString.Append($" - {((AnimeItemViewModel)entry).TopLeftInfoBind}");
            }
            tileXmlString.Append("</text>");
            tileXmlString.Append("</binding>");
            tileXmlString.Append("</visual>");
            tileXmlString.Append("</tile>");
            //uff, yup... that was scarry mess

            try
            {
                var mgr   = TileUpdateManager.CreateTileUpdaterForSecondaryTile(entry.Id.ToString());
                var notif = new Windows.Data.Xml.Dom.XmlDocument();
                notif.LoadXml(tileXmlString.ToString());
                mgr.Update(new TileNotification(notif));
            }
            catch (Exception)
            {
                // no tile
            }
        }
        public static async Task PinTile(IAnimeData entry, Uri imgUri, Uri wideImgUri, PinTileSettings settings, PinTileActionSetting action)
        {
            try
            {
                //prepare images
                if (imgUri != null)
                {
                    var file = await StorageFile.GetFileFromApplicationUriAsync(imgUri);

                    var folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("PinnedTilesImages",
                                                                                             CreationCollisionOption.OpenIfExists);

                    await file.CopyAsync(folder, entry.Id + ".png", NameCollisionOption.ReplaceExisting);

                    if (!imgUri.Equals(wideImgUri))
                    {
                        file = await StorageFile.GetFileFromApplicationUriAsync(wideImgUri);

                        await file.CopyAsync(folder, entry.Id + "Wide.png", NameCollisionOption.ReplaceExisting);

                        wideImgUri = new Uri($"ms-appdata:///local/PinnedTilesImages/{entry.Id}Wide.png");
                    }
                    else
                    {
                        wideImgUri = new Uri($"ms-appdata:///local/PinnedTilesImages/{entry.Id}.png");
                    }

                    imgUri = new Uri($"ms-appdata:///local/PinnedTilesImages/{entry.Id}.png");
                }
                else
                {
                    imgUri     = new Uri("ms-appx:///Assets/Square150x150Logo.scale-200.png");
                    wideImgUri = new Uri("ms-appx:///Assets/Wide310x150Logo.scale-200.png");
                }
                //pin tile
                if (action.Action == TileActions.OpenUrl)
                {
                    if (!action.Param.Contains("http"))
                    {
                        action.Param = "http://" + action.Param;
                    }
                }
                var tile = new SecondaryTile(entry.Id.ToString(),
                                             "MALClient",
                                             string.Join(";", action.Action.ToString(), action.Param),
                                             imgUri,
                                             TileSize.Square150x150);

                tile.VisualElements.Wide310x150Logo = wideImgUri;
                RegisterTile(entry.Id.ToString());
                await tile.RequestCreateAsync();

                RegisterTileCache(entry.Id, new PinnedTileCache {
                    ImgUri = imgUri, WideImgUri = wideImgUri, Settings = settings
                });
                if (settings.AnythingAtAll)
                {
                    UpdateTile(entry, imgUri, wideImgUri, settings);
                }
                ResourceLocator.TelemetryProvider.TelemetryTrackEvent(TelemetryTrackedEvents.PinnedTile);
            }
            catch (Exception)
            {
                //who knows?
            }
        }