Beispiel #1
0
        private void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            try
            {
                var         json   = e.Result;
                SongDetails result = JsonConvert.DeserializeObject <SongDetails>(json);

                if (!result.type.Contains("notfound"))
                {
                    textBoxLetra.Text         = result.mus[0].text.Replace("\n", Environment.NewLine);
                    linkLabelVagalume.Text    = result.mus[0].url;
                    linkLabelVagalume.Visible = true;
                }
                else
                {
                    textBoxLetra.Text = "Ocorreu algum erro! Música não reconhecida.";
                }

                if (result.mus.Any() && result.mus[0].translate.Any())
                {
                    textBoxTraducao.Text = result.mus[0].translate[0].text.Replace("\n", Environment.NewLine);
                }
                else
                {
                    textBoxTraducao.Text = "Ocorreu algum erro! Tradução não encontrada.";
                }
            }
            catch
            {
                textBoxLetra.Text = "Ocorreu algum erro! Música não reconhecida.";
            }
        }
Beispiel #2
0
 private void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
 {
     try{
         var         json   = e.Result;
         SongDetails result = JsonConvert.DeserializeObject <SongDetails>(json);
         if (result.type.Contains("notfound"))
         {
             textBoxLetra.Text = "Ocorreu algum erro! Música não reconhecida.";
         }
         else
         {
             textBoxLetra.Text = result.mus[0].text.Replace("\n", Environment.NewLine);
         }
     }catch {
         textBoxLetra.Text = "Ocorreu algum erro! Música não reconhecida.";
     }
 }