TraktPlugin.GUI.GUIDialogPinCode.OnAction C# (CSharp) Méthode

OnAction() public méthode

public OnAction ( MediaPortal.GUI.Library.Action action ) : void
action MediaPortal.GUI.Library.Action
Résultat void
        public override void OnAction(Action action)
        {
            switch (action.wID)
            {
                case Action.ActionType.REMOTE_1:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "1";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.REMOTE_2:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "2";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.REMOTE_3:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "3";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.REMOTE_4:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "4";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.REMOTE_5:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "5";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.REMOTE_6:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "6";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.REMOTE_7:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "7";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.REMOTE_8:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "8";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.REMOTE_9:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "9";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.REMOTE_0:
                    if (EnteredPinCode.Length >= 4) return;
                    EnteredPinCode = EnteredPinCode + "0";
                    UpdatePinCode(EnteredPinCode.Length);
                    break;
                case Action.ActionType.ACTION_KEY_PRESSED:
                    // some types of remotes send ACTION_KEY_PRESSED instead of REMOTE_0 - REMOTE_9 commands
                    if (EnteredPinCode.Length >= 4) return;
                    if (action.m_key != null && action.m_key.KeyChar >= '0' && action.m_key.KeyChar <= '9')
                    {
                        char key = (char)action.m_key.KeyChar;
                        EnteredPinCode = EnteredPinCode + key;
                        UpdatePinCode(EnteredPinCode.Length);
                    }
                    break;
                case Action.ActionType.ACTION_DELETE_ITEM:
                case Action.ActionType.ACTION_MOVE_DOWN:
                case Action.ActionType.ACTION_MOVE_LEFT:
                    if (EnteredPinCode.Length > 0)
                    {
                        EnteredPinCode = EnteredPinCode.Substring(0, EnteredPinCode.Length - 1);
                        UpdatePinCode(EnteredPinCode.Length);
                    }
                    break;
                case Action.ActionType.ACTION_SELECT_ITEM:
                    PageDestroy();
                    return;
                case Action.ActionType.ACTION_PREVIOUS_MENU:
                case Action.ActionType.ACTION_CLOSE_DIALOG:
                case Action.ActionType.ACTION_CONTEXT_MENU:
                    PageDestroy();
                    return;
            }

            base.OnAction(action);
        }