home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Executing an external application....and getting its output
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="samuel337" data-source="post: 53355" data-attributes="member: 10347"><p>Ok, I've knocked up some code. Its not exactly thread-safe due to some missing implementations in the MP code (compared with the winforms code), but it works.</p><p></p><p>Note: What I've done can also be accomplished using the backgroundworker object in .NET 2.0. See the Alarm.cs file in MP's source code for more information. However, that method only allows you to report numerical progress for complete thread-safety.</p><p></p><p>My code approaches it in a slightly different sort of way, and as I said before, it isn't technically thread-safe (at least I don't think so anyway).</p><p></p><p>You can download the sample code at:</p><p><a href="ftp://lai-family.homeip.net/public-web/MultiThreadDemoPlugin.zip" target="_blank">ftp://lai-family.homeip.net/public-web/MultiThreadDemoPlugin.zip</a></p><p></p><p>Copy the dll file in MultiThreadDemoPlugin\bin\debug to your MediaPortal\plugins\windows folder, and the xml file in the same folder to MediaPortal\skin\BlueTwo (or which other skin you're using, though I've only tested it with BlueTwo).</p><p></p><p>Now go into MP Configuration and make sure the plugin is enabled, and check that it is on the Menu in the Home plugin setup.</p><p></p><p>Now load MP, find the Multi Thread Demo plugin and click!</p><p></p><p>A new screen should open almost immediately, and the list should slowly populate (I introduced a delay to show the effect of multi-threading). When its done, it will display a message. IT will display all the files in your C:\windows folder (if you've installed windows elsewhere, this will not work).</p><p></p><p>The code's pretty self-explanatory, but feel free to ask questions and make improvements.</p><p></p><p><strong>EDIT: whoops, seems like threading is way harder than I thought. I've hit a dead end - the code in this example provides no way to kill the new thread when the window is closed.</strong></p><p></p><p>HTH</p><p></p><p>Sam</p></blockquote><p></p>
[QUOTE="samuel337, post: 53355, member: 10347"] Ok, I've knocked up some code. Its not exactly thread-safe due to some missing implementations in the MP code (compared with the winforms code), but it works. Note: What I've done can also be accomplished using the backgroundworker object in .NET 2.0. See the Alarm.cs file in MP's source code for more information. However, that method only allows you to report numerical progress for complete thread-safety. My code approaches it in a slightly different sort of way, and as I said before, it isn't technically thread-safe (at least I don't think so anyway). You can download the sample code at: [url]ftp://lai-family.homeip.net/public-web/MultiThreadDemoPlugin.zip[/url] Copy the dll file in MultiThreadDemoPlugin\bin\debug to your MediaPortal\plugins\windows folder, and the xml file in the same folder to MediaPortal\skin\BlueTwo (or which other skin you're using, though I've only tested it with BlueTwo). Now go into MP Configuration and make sure the plugin is enabled, and check that it is on the Menu in the Home plugin setup. Now load MP, find the Multi Thread Demo plugin and click! A new screen should open almost immediately, and the list should slowly populate (I introduced a delay to show the effect of multi-threading). When its done, it will display a message. IT will display all the files in your C:\windows folder (if you've installed windows elsewhere, this will not work). The code's pretty self-explanatory, but feel free to ask questions and make improvements. [b]EDIT: whoops, seems like threading is way harder than I thought. I've hit a dead end - the code in this example provides no way to kill the new thread when the window is closed.[/b] HTH Sam [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Executing an external application....and getting its output
Contact us
RSS
Top
Bottom