Ejemplo n.º 1
0
 private void RaiseOnRecongnitionStateChanged(ShazamRecognitionState State, ShazamResponse Response)
 {
     if (OnRecongnitionStateChanged != null)
     {
         RaiseEventOnUIThread(OnRecongnitionStateChanged, new object[] { State, Response });
     }
 }
Ejemplo n.º 2
0
        public static void ShazamStateChanged(ShazamRecognitionState State, ShazamResponse response)
        {
            switch (State)
            {
            case ShazamRecognitionState.Sending:
                MainForm.SetStatus("Sending..");
                break;

            case ShazamRecognitionState.Matching:
                MainForm.SetStatus("Matching..");

                break;

            case ShazamRecognitionState.Done:


                if (response.Tag != null)
                {
                    if (response.Tag.Track != null)
                    {
                        MainForm.notifyIcon.BalloonTipText =
                            $"{response.Tag.Track.Title} - {response.Tag.Track.Artist}";
                        MainForm.notifyIcon.BalloonTipTitle =
                            "Found!";
                        MainForm.notifyIcon.ShowBalloonTip(2000);
                        MainForm.SetText(response.Tag.Track.Title + " - " +
                                         response.Tag.Track.Artist);
                    }
                    else
                    {
                        MainForm.notifyIcon.BalloonTipText  = "Not Found!";
                        MainForm.notifyIcon.BalloonTipTitle =
                            "";
                        MainForm.notifyIcon.ShowBalloonTip(2000);
                    }
                }
                else
                {
                    MainForm.notifyIcon.BalloonTipText  = "Not Found!";
                    MainForm.notifyIcon.BalloonTipTitle =
                        "";
                    MainForm.notifyIcon.ShowBalloonTip(2000);
                }
                MainForm.SetStatus("Ready");
                MainForm.SetBool(true);
                break;

            case ShazamRecognitionState.Failed:

                if (!string.IsNullOrEmpty(response.Exception.Message))
                {
                    throw new Exception("Failed! Message: " + response.Exception.Message);
                }


                break;
            }
        }
Ejemplo n.º 3
0
        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;
            }
        }