MP1-4720 Public method to try to fix some loadSkin error from plugin side

Discussion in 'General Development (no feature request here!)' started by Sebastiii, November 24, 2015.

  1. Sebastiii
    • Team MediaPortal

    Sebastiii Development Group

    Joined:
    November 12, 2007
    Messages:
    16,240
    Likes Received:
    6,203
    Gender:
    Male
    Location:
    France
    Ratings:
    +10,202 / 9
    Home Country:
    France France
    Show System Specs
    Hi,

    I have opened a Jira to try to do something to let plugin to be in sync when working with GUI :
    https://issues.team-mediaportal.com/browse/MP1-4720

    Trying to add a public method that plugin dev can use to loadskin in main thread.

    public static readonly SynchronizationContext _mainThreadContext = SynchronizationContext.Current;

    _mainThreadContext will be init on MP main thread, like this plugin can use it to be in sync for ex :



    if (!_playbackStopped)
    {
    _mainThreadContext.Send(delegate
    {
    g_Player.ShowFullScreenWindow();
    }, null);
    }

    Like this g_Player.ShowFullScreenWindow(); will be executed in sync with MP main thread.

    Plugin dev need to ref to core.dll and in plugin when thing need to be sync with MP main thread, it should use like this :

    Code (C):
    1. GUIWindow._mainThreadContext.Send(delegate {
    2. // code
    3. // code
    4. // etc;
    5. }, null);
     
    • Like Like x 2
    • Thank You! Thank You! x 2
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Sebastiii
    • Team MediaPortal

    Sebastiii Development Group

    Joined:
    November 12, 2007
    Messages:
    16,240
    Likes Received:
    6,203
    Gender:
    Male
    Location:
    France
    Ratings:
    +10,202 / 9
    Home Country:
    France France
    Show System Specs
    In fact, when we run into a loadskin error, we should try to fix it one by one.
     
    • Like Like x 2
  4. regeszter
    • Team MediaPortal

    regeszter Retired Team Member

    Joined:
    October 29, 2005
    Messages:
    5,335
    Likes Received:
    2,863
    Ratings:
    +5,152 / 18
    Home Country:
    Hungary Hungary
    Is it possible to change the core to be sync all public GUI methods?

    For examlpe: // try TV

    Code (Text):
    1.     public static bool ShowFullScreenWindow()
    2.     {
    3.       Log.Debug("g_Player: ShowFullScreenWindow");
    4.  
    5.       if (RefreshRateChanger.RefreshRateChangePending)
    6.       {
    7.         RefreshRateChanger.RefreshRateChangeFullscreenVideo = true;
    8.         return true;
    9.       }
    10.       // does window allow switch to fullscreen?
    11.       GUIWindow win = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow);
    12.       if (!win.FullScreenVideoAllowed)
    13.       {
    14.         Log.Error("g_Player: ShowFullScreenWindow not allowed by current window");
    15.         return false;
    16.       }
    17.       // try TV
    18.       if (_showFullScreenWindowTV != null)
    19.       {
    20.         _mainThreadContext.Send(delegate
    21.         {
    22.           if (_showFullScreenWindowTV())
    23.           {
    24.             return true;
    25.           }
    26.         }, null);      
    27.       }
    28.       // try Video
    29.       if (_showFullScreenWindowVideo != null && _showFullScreenWindowVideo())
    30.       {
    31.         return true;
    32.       }
    33.       // try Other
    34.       if (_showFullScreenWindowOther != null && _showFullScreenWindowOther())
    35.       {
    36.         return true;
    37.       }
    38.  
    39.       Log.Debug("g_Player: ShowFullScreenWindow cannot switch to fullscreen");
    40.       return false;
    41.     }
    42.  

    I did not check this. It was created by notepad. :)
     
    • Thank You! Thank You! x 2
    • Like Like x 1
  5. Sebastiii
    • Team MediaPortal

    Sebastiii Development Group

    Joined:
    November 12, 2007
    Messages:
    16,240
    Likes Received:
    6,203
    Gender:
    Male
    Location:
    France
    Ratings:
    +10,202 / 9
    Home Country:
    France France
    Show System Specs
    We/I try do try to do the sync in loadskin method with no luck lol.
    Seems above code looks ok, i didn't test it in VS but that the idea :)
    Thanks for it :)
     
    • Like Like x 2
  6. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,620
    Likes Received:
    2,652
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,603 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    The error can occur here ...
     
    • Like Like x 2
  7. Sebastiii
    • Team MediaPortal

    Sebastiii Development Group

    Joined:
    November 12, 2007
    Messages:
    16,240
    Likes Received:
    6,203
    Gender:
    Male
    Location:
    France
    Ratings:
    +10,202 / 9
    Home Country:
    France France
    Show System Specs
    Updated installer to Jira :)
     
    • Like Like x 3
  8. Sebastiii
    • Team MediaPortal

    Sebastiii Development Group

    Joined:
    November 12, 2007
    Messages:
    16,240
    Likes Received:
    6,203
    Gender:
    Male
    Location:
    France
    Ratings:
    +10,202 / 9
    Home Country:
    France France
    Show System Specs
    It's better but i just get one LoadSkin error : (from logomanager, so it must also be fixed on plugin side) @Edalex

    upload_2015-11-28_17-32-56.png
     
    • Like Like x 2
    • Agree Agree x 1
  9. Edalex
    • Premium Supporter

    Edalex Community Plugin Dev

    Joined:
    January 3, 2008
    Messages:
    2,900
    Likes Received:
    709
    Gender:
    Male
    Location:
    Saratov
    Ratings:
    +1,223 / 9
    Home Country:
    Russian Federation Russian Federation
    Show System Specs
    • Agree Agree x 2
    • Thank You! Thank You! x 1
  10. Sebastiii
    • Team MediaPortal

    Sebastiii Development Group

    Joined:
    November 12, 2007
    Messages:
    16,240
    Likes Received:
    6,203
    Gender:
    Male
    Location:
    France
    Ratings:
    +10,202 / 9
    Home Country:
    France France
    Show System Specs
    Yeahhhh :)
     
  11. azzuro
    • Team MediaPortal

    azzuro Test Group

    Joined:
    May 10, 2007
    Messages:
    8,397
    Likes Received:
    2,479
    Occupation:
    technician HVAC
    Location:
    France - IDF
    Ratings:
    +4,136 / 13
    Home Country:
    France France
    Show System Specs
    Hey, Seb if this thread is related to our discussion on LMH thread, it work fine for me. no more issu;e and i use Logomanager too.
     
    • Like Like x 2
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!