Uploaded image for project: 'MediaPortal 1'
  1. MediaPortal 1
  2. MP1-4720

Added public method for plugins to use loadskin in main MP thread

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 1.13.0
    • 1.12.100
    • general
    • None

    Description

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

      <p>public static readonly SynchronizationContext _mainThreadContext = SynchronizationContext.Current;</p>

      <p>_mainThreadContext &nbsp;will be init on MP main thread, like this plugin can use it to be in sync for ex :</p>

      <p>if (!_playbackStopped)<br />
      &nbsp; &nbsp; &nbsp; {<br />
      &nbsp; &nbsp; &nbsp; &nbsp; _mainThreadContext.Send(delegate<br />
      &nbsp; &nbsp; &nbsp; &nbsp; {<br />
      &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; g_Player.ShowFullScreenWindow();<br />
      &nbsp; &nbsp; &nbsp; &nbsp; }, null);<br />
      &nbsp; &nbsp; &nbsp; }</p>

      <p>Like this&nbsp;g_Player.ShowFullScreenWindow(); will be executed in sync with MP main thread.</p>

      <p>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 :&nbsp;</p>

      <pre class="brush: csharp;" name="code" style="background-color:#f7f7f7;border:1px solid #d7d7d7;padding:.5em 1em .5em 1em;">
              GUIWindow._mainThreadContext.Send(delegate {
                // code
                // code
                // etc;
              }, null);</pre>

      <p>&nbsp;</p>

      <p>&nbsp;</p>

      <p>&nbsp;</p>

      Attachments

        Activity

          People

            sebastiii sebastiii
            sebastiii sebastiii
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: