Browsetheweb for mediaportal 2 (3 Viewers)

doskabouter

Development Group
  • Team MediaPortal
  • September 27, 2009
    4,566
    2,938
    Nuenen
    Home Country
    Netherlands Netherlands
    In this case I want to know if a user has pressed a number, and execute some code when that happens.

    Edit: so just add an eventhandler like SkinContext.Form.KeyDown += frm_KeyDown ? Is that the preferred way?

    Edit2: No way that can be used, it never accounts for keybindings/remote control presses etc. What I'm looking for is the MP2 counterpart of MP1's OnAction event
     
    Last edited:

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Please check the IInputManager service: https://github.com/MediaPortal/Medi...ntrol/InputManager/IInputManager.cs#L125-L144. It's accessible via ServiceRegistration.Get<IInputManager>().

    The highlighted methods allow you to register global key bindings, like I do with F10 to toggle StatisticsRenderer.

    But preferrably you should define the KeyBindings in the screen where you want to react on them. See the "FullscreenContentTV" for an example: https://github.com/MediaPortal/Medi...nium/screens/FullScreenContentTv.xaml#L49-L66.

    This means, for all cases where you have a screen, you should use the XAML way like the 2nd example.
     

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    4,566
    2,938
    Nuenen
    Home Country
    Netherlands Netherlands
    Ok, what are the restrictions/demands on that? I've put a
    <KeyBinding Key="1" Command="{Command NumberPressed}"/>
    in my main xaml, but I keep getting
    CommandBaseMarkupExtension: Could not find source value, could not execute command ({Command Path=NumberPressed})
    Also tried Command BrowseTheWebModel.NumberPressed but that didn't help

    Numberpressed is declared as:

    public class BrowseTheWebModel : IWorkflowModel
    {
    public void NumberPressed()
    {
    throw new NotImplementedException();
    }
    }
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    4,566
    2,938
    Nuenen
    Home Country
    Netherlands Netherlands
    Yes, this works, thanks a lot!

    Small steps forward every time...

    Edit: Can I add a parameter to the commands, so that I don't need to add 10 methods for each number?
    Edit2: Found some example for this, but not working :(
     
    Last edited:

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    4,566
    2,938
    Nuenen
    Home Country
    Netherlands Netherlands
    I think I've made a bit of a mess of MP2 :(
    One of the symptoms is regular crashes (without triggering exceptions when run in visual studio)
    Another one is the inability to find Mediaportal.Common.XmlSerializers (exception thrown on line 154 of PathManager.cs (
    XmlSerializer s = new XmlSerializer(typeof(PathListFile)); )

    An important question on how to fix all this is: Will MP2-client run from visual studio without MP2 being installed on the system, or do I need to remove all MP2-related stuff and do an install again?
     

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    Will MP2-client run from visual studio without MP2 being installed on the system
    If you can compile MP2-Client, it will run :) I have several checkouts of MP2 code in parallel so I can develop on different parts. Each working copy can run by itself without inteferring others. So no worries here.

    Only settings from ProgramData will be used by all instances, so if you have problems with settings, you might try to remove ProgramData\Team MediaPortal\MP2-Client\Config folder
     

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    4,566
    2,938
    Nuenen
    Home Country
    Netherlands Netherlands
    Well, that problem is solved.
    But again, I have a new one. Since I removed the MP2 installation (which my project referenced) I can't get my project to compile again.

    The source of this I don't really grasp, but the messages are the same as with the regular sources of the MP2 client, after you add the test-border.xaml to the guitestplugin.
    Don't know if these kind of xaml's (with a Screen node as root) are supposed to not being included in the sources, or that they are just some leftovers from refactoring and should be changed to root nodes "Include"

    Edit: adding <?xml version="1.0" encoding="utf-8"?> as first line to test-border.xaml fixes some errors, but by far not all
     
    Last edited:

    morpheus_xx

    Retired Team Member
  • Team MediaPortal
  • March 24, 2007
    12,073
    7,459
    Home Country
    Germany Germany
    I'd suggest that you add your plugin for development into the "incubator" folder of MP2 and to the MP2-Client solution, so you can reference the projects instead of compiled binaries. This also makes debugging easier, as all sources are available in MP2.
     

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    4,566
    2,938
    Nuenen
    Home Country
    Netherlands Netherlands
    Well that's indeed one thing.
    Still doesn't explain the compiling errors when that test-border.xaml is added to the project.
    This is on the current weekly branch, can you please explain/clarify that?

    Well, carnaval costed me more than I bargained for... The source of all compiler errors boiled down to me overseeing that adding my plugin changed the build target from x86 to anycpu :sleep:
     
    Last edited:

    Users who are viewing this thread

    Top Bottom