Normal
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:ftp://lai-family.homeip.net/public-web/MultiThreadDemoPlugin.zipCopy 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.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.HTHSam
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:
ftp://lai-family.homeip.net/public-web/MultiThreadDemoPlugin.zip
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.
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.
HTH
Sam