Browsetheweb for mediaportal 2 (1 Viewer)

doskabouter

Development Group
  • Team MediaPortal
  • September 27, 2009
    3,958
    2,197
    Nuenen
    Home Country
    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,752
    7,115
    Home Country
    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,982
    3,703
    Stuttgart
    Home Country
    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,752
    7,115
    Home Country
    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,958
    2,197
    Nuenen
    Home Country
    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,752
    7,115
    Home Country
    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,958
    2,197
    Nuenen
    Home Country
    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,958
    2,197
    Nuenen
    Home Country
    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,752
    7,115
    Home Country
    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

    Similar threads

    We are proud to present MediaPortal 2.3.1 MediaPortal 2.3.1 is a full-blown media center software that addresses the most common user requirements out of the box. Aside from its support for Live TV and Radio, it offers a complete media server for music, movies, and TV shows. Info is automatically downloaded from various sources to...
    We are proud to present MediaPortal 2.3.1 MediaPortal 2.3.1 is a full-blown media center software that addresses the most common...
    We are proud to present MediaPortal 2.3.1 MediaPortal 2.3.1 is a full-blown media center software that addresses the most common...
    Replies
    0
    Views
    829
    Many thanks for your fast response. Hopefully I'll get to work through these items in the next few days. Kind regards.
    Many thanks for your fast response. Hopefully I'll get to work through these items in the next few days. Kind regards.
    Hi, I'm new to the world of HTPC and Media Portal but I've decided to give it a go since my Pioneer DVR-LX60D PVR failed and is...
    Replies
    2
    Views
    665
    Good work guys!
    Good work guys!
    We are proud to present MediaPortal 2.2.1 After the release of MediaPortal 2.2 Final the team focussed on improving usability and...
    Replies
    1
    Views
    3K
    1.4.x - Themes: BasicHome, Clear Art's support for Titan, Weather icon on screen, bugfixes and more. -- WBR, ajs :):whistle::coffee:
    1.4.x - Themes: BasicHome, Clear Art's support for Titan, Weather icon on screen, bugfixes and more. -- WBR, ajs :):whistle::coffee:
    When I start the Trakt-plugin from the plugin menu I get a black screen and the error "Invalid or missing file:". Yep, that's the...
    Replies
    8
    Views
    669
    Also maybe try increasing the 'Tune' timeout in the TV Serve Configuration -> General tab -> Scan tab - see: General Configuration Default is 2 seconds - maybe try 5 seconds?
    Also maybe try increasing the 'Tune' timeout in the TV Serve Configuration -> General tab -> Scan tab - see: General Configuration...
    Hello! I'm new to all this, and new to the forum. I have bought a DVB-T tuner, and I can't seem to get it working with MediaPortal...
    Replies
    12
    Views
    3K
    Top Bottom