Exemple #1
0
 public static async Task<tagInfo> getInfo(string tagName, string lang = "en")
 {
     RequestParameters rParams = new RequestParameters("tag.getinfo");
     rParams.Add("tag", tagName);
     rParams.Add("lang", lang);
     XDocument returnedXml = await Request.MakeRequest(rParams);
     if (Request.CheckStatus(returnedXml) == 0)
     {
         tagInfo retTag = new tagInfo(returnedXml.Element("lfm").Element("tag"));
         return retTag;
     }
     else
         throw new LastFmAPIException(returnedXml);
 }
Exemple #2
0
        private async void getTagInfo(string tagName)
        {
            prog.IsVisible = true;
            prog.IsIndeterminate = true;

            try { currTag = await tag.getInfo(tagName); }
            catch (TaskCanceledException) { }

            //NavigateToString method works bad with encodings, that's why I am using this stuff
            var store = IsolatedStorageFile.GetUserStoreForApplication();
            using (var stream = new IsolatedStorageFileStream("tag.html", FileMode.Create, FileAccess.Write, store))
            {
                using (var sw = new StreamWriter(stream))
                    sw.Write(utilities.makeHtmlFromCdata(currTag.description));
            }
            tagDescription.Navigate(new Uri("tag.html", UriKind.Relative));

            this.DataContext = currTag;
            prog.IsVisible = false;
            prog.IsIndeterminate = false;
        }