TraktPlugin.GUI.GUISearch.OnClicked C# (CSharp) Méthode

OnClicked() protected méthode

protected OnClicked ( int controlId, GUIControl control, MediaPortal.GUI.Library.Action actionType ) : void
controlId int
control MediaPortal.GUI.Library.GUIControl
actionType MediaPortal.GUI.Library.Action
Résultat void
        protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
        {
            // wait for any background action to finish
            if (GUIBackgroundTask.Instance.IsBusy) return;

            switch (controlId)
            {
                // Facade
                case (50):
                    if (actionType == Action.ActionType.ACTION_SELECT_ITEM)
                    {
                        GUIListItem selectedItem = this.Facade.SelectedListItem;
                        if (selectedItem == null) return;

                        // Load selected search results
                        SendSearchResultsToWindow(SearchResults);
                    }
                    break;

                // Search
                case (2):
                    // check if there is any types selected
                    SetSearchTypes();
                    if (SearchTypes.Count > 0)
                    {
                        string searchTerm = SearchTerm ?? string.Empty;
                        if (GUIUtils.GetStringFromKeyboard(ref searchTerm))
                        {
                            if (!string.IsNullOrEmpty(searchTerm))
                            {
                                GUIUtils.SetProperty("#Trakt.Search.SearchTerm", searchTerm);

                                SearchTerm = searchTerm;
                                LoadSearchResults();
                            }
                        }
                    }
                    else
                    {
                        GUIUtils.ShowOKDialog(Translation.Search, Translation.NoSearchTypesSelected);
                    }
                    break;

                default:
                    break;
            }
            base.OnClicked(controlId, control, actionType);
        }