Browsetheweb for mediaportal 2 (1 Viewer)

doskabouter

Development Group
  • Team MediaPortal
  • September 27, 2009
    3,536
    1,742
    Nuenen
    Netherlands Netherlands
    Country flag
    Hi folks,

    I'm trying to port the browsetheweb plugin to mediaportal 2, and I must admit, it's a bit more challenging than I thought.
    Did do a lot of reading on the subject, but none of it was able to answer the specific questions I'm facing.

    So I'm calling in to see if anyone will nudge me in the right direction, or help me out with smaller or larger issues I encounter.

    First thing that's bugging me, is that I don't really know what's the preferred way of putting a winforms component (the GeckoWebBrowser) on a screen in MP2.
    2 options are available:
    1: is to somehow put that component in the xaml, but that might have the disadvantage of getting created too soon (ie before config is available, or perhaps being unnecessarily created), but advantage seems to be that it's resized automatically according to clientwindow size
    2: is to dynamically create the GeckoWebBrowser on plugin entry, but then I don't know how to get it's current size and position, nor do I know (yet) if resizing occurred

    Once that is working, I think I have some more questions (f.e. how to work with the statusbar in BrowseTheWeb), but I'll be glad if the first one is solved.

    I have vs2013 Community edition, but I'm not able to open the xaml files without error messages (Invalid markup, several identifiers missing in namespace, f.e. The name "Include" does not exist in the namespace "www.team-mediaportal.com/2008/mpf/directx". )
    Is this because the xaml's are customized to fit the skinengine, or am I missing some crucial piece of software?

    Paul
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,972
    Germany Germany
    Country flag
    I try to start with the simpler answers :)
    I have vs2013 Community edition, but I'm not able to open the xaml files without error messages (Invalid markup, several identifiers missing in namespace, f.e. The name "Include" does not exist in the namespace "www.team-mediaportal.com/2008/mpf/directx". )
    Is this because the xaml's are customized to fit the skinengine, or am I missing some crucial piece of software?
    If you are on master/dev branch, this is normal. I recently tried to improve the situation as described here: https://forum.team-mediaportal.com/threads/wip-adding-design-time-support-for-mpf-xaml.128516/.

    This means, inside "Weekly" branch the partial support for autocomplete of XAML is available. But it doesn't bring a visual designer :(

    First thing that's bugging me, is that I don't really know what's the preferred way of putting a winforms component (the GeckoWebBrowser) on a screen in MP2.
    2 options are available:
    1: is to somehow put that component in the xaml, but that might have the disadvantage of getting created too soon (ie before config is available, or perhaps being unnecessarily created), but advantage seems to be that it's resized automatically according to clientwindow size
    2: is to dynamically create the GeckoWebBrowser on plugin entry, but then I don't know how to get it's current size and position, nor do I know (yet) if resizing occurred
    Good question...

    I think this is something that @EWeiss would also need for his Bass Visualization, where also a form is overlayed.

    The problem is to place / size the form to match the desired screen position, correct? In this case I could imagine a custom control like:

    <WinFormHost x:Name="BrowserForm" />

    which can be in principle a Panel. Then you could place it in any desired position in screen. This has the advantage that the control can be controlled by skin. Then in code behind it can forward the position to the "hosted" form (not sure how this currently works).
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,981
    3,703
    Stuttgart
    Germany Germany
    Country flag
    Hi Paul,
    since I am not that deep into the MP2 code and have not yet done anything similar I am not really of help for now :( sorry. Onlinevideos for MP2 does only use the internal player, nothing like vlc and wmp hosting as in MP1 ;)
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,972
    Germany Germany
    Country flag
    @doskabouter is there already some code to look at? Maybe I can help better then.

    If you need "only" some way to control the size and position of a WinForm (that gets positioned absolutely over the MP2-Form), you might create a simple own control.

    It could derive from any UIElement and only needs to do the size/position calculation and instead of rendering it can take care to place the WinForm into right position.

    It's just an idea...
     

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    3,536
    1,742
    Nuenen
    Netherlands Netherlands
    Country flag
    Well, I don't have any code yet that is not more than the sample plugin. I'm still trying to figure the basics.

    If I use a winform derived class (actually don't need to create a new one, GeckoWebBrowser is derived from System.Windows.Forms.Control), to what do I set the parent/owner so that events are propagated correctly?
    As far as I can see, a UIElement doesn't derive from anything Form-related...
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,972
    Germany Germany
    Country flag
    If I use a winform derived class (actually don't need to create a new one, GeckoWebBrowser is derived from System.Windows.Forms.Control), to what do I set the parent/owner so that events are propagated correctly?
    Ah, ok. This is the easier part: you can access the Form ("MainForm) via SkinContext.Form.
     

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    3,536
    1,742
    Nuenen
    Netherlands Netherlands
    Country flag
    Well, easy...:
    System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Controls created on one thread cannot be parented to a control on a different thread.

    Edit: but I'll look into this
    Edit2: Looking promising!
     
    Last edited:

    doskabouter

    Development Group
  • Team MediaPortal
  • September 27, 2009
    3,536
    1,742
    Nuenen
    Netherlands Netherlands
    Country flag
    It's still quite a challenge.
    For starters, when I enter the BTWeb plugin (yes, it actually shows a website with numbered links!) and just wait a bit, MP2 closes without any triggered exception when run in the debugger.
    When started natively, it generates an appcrash message from somewhere in the xul.dll...
    Something I have to dive in deeply.

    In the mean time, I have another (hopefully as simple as the SkinContext.Form one): How can I trigger on a keypress (0..9 in particular)?
     

    morpheus_xx

    Lead Dev MP2
  • Team MediaPortal
  • March 24, 2007
    11,400
    6,972
    Germany Germany
    Country flag
    There is a service, ServiceRegistration.Get <IInputManager>() which allows sending and handling of keypresses.
    Also all GUl controls have internal handlers to react on keys. So it depends what you like to achieve.
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    Symphy Version 0.2.9.0 for MediaPortal 1.25 ASIO music player 0
    doskabouter Installing mediaportal MediaPortal 1 3
    A Mediaportal Allgemeines Support- und Diskussionsforum 0
    G Update von MediaPortal Installationsprobleme? 0
    ajs [News] MediaPortal 1 - 1.25 Released! News and Announcements 1
    horned_reaper Standby is prevented by MediaPortal client General Support 0
    U [solved] MediaPortal crashing on startup General Support 10
    g0rsq Info box randomly popping up when watching TV or other video MediaPortal 2 Newcomers Forum 1
    high [unanswered] Hallo möchte gerne Mediaportal. nutzen kann mich jemand anrufen? contactform feedback and requests 2
    ajs [News] MediaPortal 1.25 Pre-Release ready for testing! News and Announcements 0
    ajs [Rejected] Mediaportal Codename MediaPortal 1 41
    M 2nd (Touch-)Display Support on MediaPortal 2 such MPDisplay++? General 2
    N Steam release of MediaPortal MediaPortal 1 Talk 0
    torone Dritter versuch mit Mediaportal 2 Allgemeines Support- und Diskussionsforum 1
    M Fehlerhafter Link auf der aktuellen MediaPortal Seite Page- und Forumsfeedback 0
    H 1.24.0 MP 1.24 high CPU utilization when 'Keep MediaPortal always on top' option enabled Bugreports 4
    mickb [solved] Mediaportal Stops working General Support 5
    J [solved] Newbie to MediaPortal 2 - Cannot open/run TV programs Newcomers Forum 4
    atlantic How to use Spotify inside Mediaportal? Listen Music 18
    horned_reaper MediaPortal configuration error log message General Support 1
    Rob Hexenmeister Mediaportal Properties #plot etc... General Support 3
    ajs [News] MediaPortal 1 - 1.24 Released! News and Announcements 3
    S [solved] access the desktop without leaving mediaportal General Support 5
    J New computer with win10 and how will i set Mediaportal up ? Newcomers Forum 55
    T MediaPortal Extensions Manager Fehlermeldung bei Installation einer Erweiterung Installationsprobleme? 1
    Similar threads

























    Top Bottom