catch action and avoid returning it to MediaPortal (1 Viewer)

pilehave

Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    Hi

    Under certain curcumstances, I wan't to catch a user-action (say, if the user pressed "stop" in the "my music" screen).

    Now, catching the action is easy, but how can I avoid the action to be read by MediaPortal afterwords?

    My plugin is a process-plugin.

    I have my handler like this:

    Code:
    GUIGraphicsContext.OnNewAction += new OnActionHandler(OnAction);

    OnAction then checks the action:
    Code:
    public void OnAction(MediaPortal.GUI.Library.Action action)
    {
    switch (action.wID)
    {
    case MediaPortal.GUI.Library.Action.ActionType.ACTION_STOP:
    //some function is run here
    break;
    }
    }

    :D
     

    hwahrmann

    Development Group
  • Team MediaPortal
  • September 15, 2004
    4,633
    2,457
    Vienna, Austria
    Home Country
    Austria Austria
    You can't, since any number of processes may subscribe to the OnAction Handler.
    And they get notified that this action occured, whatever they would like to do with it then.
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #3
    Even though it makes my task more difficult, I'll say thank you anyways :)
     

    pilehave

    Community Skin Designer
  • Premium Supporter
  • April 2, 2008
    2,566
    521
    Hornslet
    Home Country
    Denmark Denmark
    • Thread starter
    • Moderator
    • #4
    One of the forummembers contacted me to get the actual code to catch actions with an actionhandler. I thought I would share it for future reference, so the full code is attached. This is from the MediaStream plugin, that goes together with the MediaStream skin :)
     

    Attachments

    • MediaStream.txt
      30.6 KB

    Users who are viewing this thread

    Top Bottom