private void Lookup(string fingerprint, int duration)
{
btnFingerprint.IsEnabled = false;
LookupService service = new LookupService();
service.GetAsync((results, e) =>
{
btnOpen.IsEnabled = true;
if (e != null)
{
System.Windows.MessageBox.Show(e.Message, "Webservice error");
return;
}
if (results.Count == 0)
{
if (String.IsNullOrEmpty(service.Error))
{
System.Windows.MessageBox.Show("No results for given fingerprint.");
}
else System.Windows.MessageBox.Show(service.Error, "Webservice error");
return;
}
foreach (var result in results)
{
var li = new AcoustIdItem();
li.AcoustId = result.Id;
li.Score = result.Score.ToString();
li.Recordings = result.Recordings;
lvResults.Items.Add(li);
}
}, fingerprint, duration, new string[] { "recordings", "compress" });
}