public override bool CF_pluginCMLCommand(string command, string[] strparams, CF_ButtonState state, int zone)
 {
     if (command.Equals("Spotify.Cancel"))
     {
         if (state >= CF_ButtonState.Click)
         {
             base.DialogResult = System.Windows.Forms.DialogResult.Cancel;
         }
         return(true);
     }
     else if (command.StartsWith("Spotify.Choice"))
     {
         if (state >= CF_ButtonState.Click)
         {
             int choiceNumber = int.Parse(command.Last().ToString());
             choiceNumber--; //they are off by 1
             Choice            = choiceNumber;
             base.DialogResult = System.Windows.Forms.DialogResult.OK;
         }
         return(true);
     }
     else
     {
         return(base.CF_pluginCMLCommand(command, strparams, state, zone));
     }
 }
 public override bool CF_pluginCMLCommand(string command, string[] strparams, CF_ButtonState state, int zone)
 {
     if (command.Equals("Spotify.Cancel"))
     {
         if (state >= CF_ButtonState.Click)
         {
             base.DialogResult = System.Windows.Forms.DialogResult.Cancel;
         }
         return true;
     }
     else if (command.StartsWith("Spotify.Choice"))
     {
         if (state >= CF_ButtonState.Click)
         {
             int choiceNumber = int.Parse(command.Last().ToString());
             choiceNumber--; //they are off by 1
             Choice = choiceNumber;
             base.DialogResult = System.Windows.Forms.DialogResult.OK;
         }
         return true;
     }
     else
         return base.CF_pluginCMLCommand(command, strparams, state, zone);
 }
        public override bool CF_pluginCMLCommand(string command, string[] strparams, CF_ButtonState state, int zone)
        {
            if (!_hasControl)
                return false;

            _zone = zone;
            switch (command)
            {
                case "Spotify.NowPlaying":
                    if (state >= CF_ButtonState.Click)
                    {
                        LoadNowPlaying();
                    }
                    return true;
                case "Spotify.Search":
                    if (state == CF_ButtonState.Click)
                    {
                        LoadTrackSearch();
                    }
                    return true;
                case "Spotify.SearchHold":
                    if (state == CF_ButtonState.HoldClick)
                    {
                        var choices = new string[] { "Songs", "Albums", "Artists", "Playlists" };
                        var choiceDialog = new MultipleChoiceDialog(this.CF_displayHooks.displayNumber, this.CF_displayHooks.rearScreen, "Search for:", choices);
                        choiceDialog.MainForm = base.MainForm;
                        choiceDialog.CF_pluginInit();
                        if (choiceDialog.ShowDialog(this) == DialogResult.OK)
                        {
                            int choice = choiceDialog.Choice;
                            switch (choice)
                            {
                                case 0:
                                    LoadTrackSearch();
                                    break;
                                case 1:
                                    LoadAlbumSearch();
                                    break;
                                case 2:
                                    LoadArtistSearch();
                                    break;
                                case 3:
                                    LoadPlaylistSearch();
                                    break;
                            }
                        }
                    }
                    return true;
                case "Spotify.Inbox":
                    if (state >= CF_ButtonState.Click)
                    {
                        var choices = new string[] { "Songs", "Albums", "Playlists"};
                        var choiceDialog = new MultipleChoiceDialog(this.CF_displayHooks.displayNumber, this.CF_displayHooks.rearScreen, "Retrieve Inbox of:", choices);
                        choiceDialog.MainForm = base.MainForm;
                        choiceDialog.CF_pluginInit();
                        if (choiceDialog.ShowDialog(this) == DialogResult.OK)
                        {
                            int choice = choiceDialog.Choice;
                            switch (choice)
                            {
                                case 0:
                                    LoadInboxTracks();
                                    break;
                                case 1:
                                    LoadInboxAlbums();
                                    break;
                                case 2:
                                    LoadInboxPlaylists();
                                    break;
                            }
                        }
                    }
                    return true;
                case "Spotify.Playlists":
                    if (state >= CF_ButtonState.Click)
                    {
                        LoadPlaylists();
                    }
                    return true;
                case "Spotify.Popular":
                    if (state >= CF_ButtonState.Click)
                    {
                        var choices = new string[] { "Songs", "Albums", "Artists", "Your starred songs" };
                        var choiceDialog = new MultipleChoiceDialog(this.CF_displayHooks.displayNumber, this.CF_displayHooks.rearScreen, "Retrieve Top List Of:", choices);
                        choiceDialog.MainForm = base.MainForm;
                        choiceDialog.CF_pluginInit();
                        if (choiceDialog.ShowDialog(this) == DialogResult.OK)
                        {
                            int choice = choiceDialog.Choice;
                            switch (choice)
                            {
                                case 0:
                                    LoadPopularTracks();
                                    break;
                                case 1:
                                    LoadPopularAlbums();
                                    break;
                                case 2:
                                    LoadPopularArtists();
                                    break;
                                case 3:
                                    LoadStarredTracks();
                                    break;
                            }
                        }
                    }
                    return true;
                case "Spotify.ScrollUp":
                    if (state >= CF_ButtonState.Click)
                    {
                        var list = advancedlistArray[CF_getAdvancedListID("mainList")];
                        list.PageUp();
                    }
                    return true;
                case "Spotify.ScrollDown":
                    if (state >= CF_ButtonState.Click)
                    {
                        var list = advancedlistArray[CF_getAdvancedListID("mainList")];
                        list.PageDown();
                    }
                    return true;
                case "Spotify.DynamicButton1":
                    if (state == CF_ButtonState.Click)
                    {
                        OnDynamic1Clicked();
                    }
                    return true;
                case "Spotify.DynamicButton2":
                    if (state == CF_ButtonState.Click)
                    {
                        OnDynamic2Clicked();
                    }
                    return true;
                case "Spotify.DynamicButton1Hold":
                    if (state == CF_ButtonState.HoldClick)
                    {
                        OnDynamic1Hold();
                    }
                    return true;
                case "Spotify.DynamicButton2Hold":
                    if (state >= CF_ButtonState.HoldClick)
                    {
                        OnDynamic2Hold();
                    }
                    return true;
                case "Spotify.Back":
                    {
                        if (state >= CF_ButtonState.Click)
                        {
                            OnBackClicked();
                        }
                    }
                    return true;
                case "Spotify.DynamicButton3":
                    {
                        if (state >= CF_ButtonState.Click)
                        {
                            OnDynamic3Clicked();
                        }
                    }
                    return true;
                case "Centrafuse.Main.PlayPause":
                    if (state >= CF_ButtonState.Click)
                    {
                        PlayPause();
                    }
                    return true;
                case "Centrafuse.Main.Rewind":
                    if (state >= CF_ButtonState.Click)
                    {
                        PlayPreviousTrack(true);
                    }
                    return true;
                case "Centrafuse.Main.FastForward":
                    if (state >= CF_ButtonState.Click)
                    {
                        PlayNextTrack(true);
                    }
                    return true;

                default:
                    return base.CF_pluginCMLCommand(command, strparams, state, zone);
            }
        }
        /// <summary>
        /// Called on control clicks, down events, etc, if the control has a defined CML action parameter in the skin xml.
        /// </summary>
        /// <param name="id">The command to execute.</param>
        /// <param name="state">Button State.</param>
        /// <returns>Returns whatever is appropriate.</returns>
        public override bool CF_pluginCMLCommand(string id, string[] parameters, CF_ButtonState state, int zone)
        {
            if (!_hasControl)
                return false;

            if (state != CF_ButtonState.Click)
                return false;

            _zone = zone;

            switch (id)
            {
                case "Centrafuse.Main.PlayPause":
                    PlayPause();
                    return true;
                case "Centrafuse.Main.Rewind":
                    PreviousTrack();
                    return true;
                case "Centrafuse.Main.FastForward":
                    NextTrack();
                    return true;
            }

            return false;
        }