private void RaiseOnRecongnitionStateChanged(ShazamRecognitionState State, ShazamResponse Response) { if (OnRecongnitionStateChanged != null) { RaiseEventOnUIThread(OnRecongnitionStateChanged, new Object[] { State, Response }); } }
public void ShazamStateChanged(ShazamRecognitionState State, ShazamResponse response) { switch (State) { case ShazamRecognitionState.Sending: this.statusLabel.Text = "Sending..."; break; case ShazamRecognitionState.Matching: this.statusLabel.Text = "Matching..."; break; case ShazamRecognitionState.Done: this.statusLabel.Text = "Click to Recognize"; button1.Enabled = true; if (response.Tag != null) { if (response.Tag.Track != null) { MessageBox.Show("Title: " + response.Tag.Track.Title + "\r\nArtist: " + response.Tag.Track.Artist, "Hey!"); } else { MessageBox.Show("Song not found :-(", "Hey!"); } } else { MessageBox.Show("Song not found :-(", "Hey!"); } break; case ShazamRecognitionState.Failed: button1.Enabled = true; if (response.Exception.Message != null && response.Exception.Message != "") { this.statusLabel.Text = "Failed! Message: " + response.Exception.Message; } else { this.statusLabel.Text = "Failed!"; } break; } }