MP1-4720 Public method to try to fix some loadSkin error from plugin side (1 Viewer)

Sebastiii

Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    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:
    GUIWindow._mainThreadContext.Send(delegate {
    // code
    // code
    // etc;
    }, null);
     

    regeszter

    Retired Team Member
  • Premium Supporter
  • October 29, 2005
    5,335
    4,954
    Home Country
    Hungary Hungary
    Is it possible to change the core to be sync all public GUI methods?

    For examlpe: // try TV

    Code:
        public static bool ShowFullScreenWindow()
        {
          Log.Debug("g_Player: ShowFullScreenWindow");
    
          if (RefreshRateChanger.RefreshRateChangePending)
          {
            RefreshRateChanger.RefreshRateChangeFullscreenVideo = true;
            return true;
          }
          // does window allow switch to fullscreen?
          GUIWindow win = GUIWindowManager.GetWindow(GUIWindowManager.ActiveWindow);
          if (!win.FullScreenVideoAllowed)
          {
            Log.Error("g_Player: ShowFullScreenWindow not allowed by current window");
            return false;
          }
          // try TV
          if (_showFullScreenWindowTV != null)
          {
            _mainThreadContext.Send(delegate
            {
              if (_showFullScreenWindowTV())
              {
                return true;
              }
            }, null);      
          }
          // try Video
          if (_showFullScreenWindowVideo != null && _showFullScreenWindowVideo())
          {
            return true;
          }
          // try Other
          if (_showFullScreenWindowOther != null && _showFullScreenWindowOther())
          {
            return true;
          }
    
          Log.Debug("g_Player: ShowFullScreenWindow cannot switch to fullscreen");
          return false;
        }


    I did not check this. It was created by notepad. :)
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    • Thread starter
    • Moderator
    • #4
    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 :)
     

    Sebastiii

    Development Group
  • Team MediaPortal
  • November 12, 2007
    16,583
    10,403
    France
    Home Country
    France France
    • Thread starter
    • Moderator
    • #7
    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
     

    Users who are viewing this thread

    Top Bottom