本文整理汇总了C#中Artist.GetImageURL方法的典型用法代码示例。如果您正苦于以下问题:C# Artist.GetImageURL方法的具体用法?C# Artist.GetImageURL怎么用?C# Artist.GetImageURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artist
的用法示例。
在下文中一共展示了Artist.GetImageURL方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetArtistImageURL
public static async Task<string> GetArtistImageURL(string artistname)
{
Artist artist = new Artist(artistname, GetSession());
string url = string.Empty;
try
{
url = await Task.Run(() => artist.GetImageURL(ImageSize.Large));
}
catch (Exception ex)
{
Console.WriteLine("lastfm: couldn't fetch large image: " + ex.StackTrace);
}
if (string.IsNullOrEmpty(url))
{
try
{
url = await Task.Run(() => artist.GetImageURL(ImageSize.Medium));
}
catch (Exception ex)
{
Console.WriteLine("lastfm: couldn't fetch medium image: " + ex.StackTrace);
}
}
if (string.IsNullOrEmpty(url))
{
try
{
url = await Task.Run(() => artist.GetImageURL(ImageSize.Small));
}
catch (Exception ex)
{
Console.WriteLine("lastfm: couldn't fetch small image: " + ex.StackTrace);
}
}
return url;
}
示例2: GetArtist
private async void GetArtist()
{
Artist artist = new Artist(ArtistName, session);
ArtistImage = string.Empty;
try
{
ArtistImage = await Task.Run(() => artist.GetImageURL(ImageSize.Large));
}
catch (Exception ex)
{
Console.WriteLine("lastfm: couldn't fetch large image: " + ex.StackTrace);
}
if (string.IsNullOrEmpty(ArtistImage))
{
try
{
ArtistImage = await Task.Run(() => artist.GetImageURL(ImageSize.Medium));
}
catch (Exception ex)
{
Console.WriteLine("lastfm: couldn't fetch medium image: " + ex.StackTrace);
}
}
if (string.IsNullOrEmpty(ArtistImage))
{
try
{
ArtistImage = await Task.Run(() => artist.GetImageURL(ImageSize.Small));
}
catch (Exception ex)
{
Console.WriteLine("lastfm: couldn't fetch small image: " + ex.StackTrace);
}
}
}
示例3: button2_Click
private void button2_Click(object sender, EventArgs e)
{
string API_KEY = "60d35bf7777d870ec958a21872bacb24";
string API_SECRET = "099158e5216ad77239be5e0a2228cf04";
Session session = new Session(API_KEY, API_SECRET);
ArtistManager.Instance.InitDatabase();
List<ArtistItem> arts = ArtistManager.Instance.GetArtists();
int i = 0;
foreach (ArtistItem artistItem in arts)
{
i++;
if (string.IsNullOrEmpty(artistItem.Img_url))
{
try
{
Artist artist = new Artist(artistItem.Name, session);
artistItem.Img_url = artist.GetImageURL(ImageSize.Huge);
ArtistManager.Instance.Save(artistItem);
ArtistManager.Instance.Grabber.GetSimilarArtists(artistItem.Id);
}
catch (Exception)
{
}
label1.Text = i.ToString();
Application.DoEvents();
//Thread.Sleep(200);
}
}
}