Click here to Skip to main content
15,895,283 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII1-Jun-09 8:52
fjparisIII1-Jun-09 8:52 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 10:39
Mark Salsbery1-Jun-09 10:39 
General[Message Deleted] Pin
fjparisIII1-Jun-09 13:34
fjparisIII1-Jun-09 13:34 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 13:46
Mark Salsbery1-Jun-09 13:46 
General[Message Deleted] Pin
fjparisIII1-Jun-09 14:23
fjparisIII1-Jun-09 14:23 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 14:33
Mark Salsbery1-Jun-09 14:33 
General[Message Deleted] Pin
fjparisIII1-Jun-09 14:43
fjparisIII1-Jun-09 14:43 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 15:23
Mark Salsbery1-Jun-09 15:23 
fjparisIII wrote:
If you've got some canned code I can just pick up and shove into my app


Smile | :) that's what I tried to provide.

If you take the latest version I posted (below, the class called "WPFSTABackgroundWorker"),
add it to an app that uses BackgroundWorker, and replace any occurrence of "BackgroundWorker"
in your existing code with "WPFSTABackgroundWorker", it should work, in STA mode, unless you've
used some feature of BackgroundWorker that I didn't implement, which would be the Component class
stuff.


As for what I did -

I focused on the key convenience features of BackgroundWorker:
1) Handles starting the thread, providing a simple plug-in event handler for users
to provide the thread procedure code.
2) Provides progress update and thread end events on the UI thread.
3) Provides the ability to asynchronously cancel (in my second version)

My functional requirements:
1) I wanted it to replace BackgroundWorker and be source compatible with
BackgroundWorker, except for the class name.
2) I don't use any of the Component class features, so I saw no need to implement
that class like BackgroundWorker does.

A couple things that make my implementation not as good as BackgroundWorker
(I'm sure many more could be found):
1) Doesn't implement Component
2) I used the WPF Application class to raise events on the UI thread, so the
class is only usable in a WPF app.

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

General[Message Deleted] Pin
fjparisIII1-Jun-09 16:05
fjparisIII1-Jun-09 16:05 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 17:09
Mark Salsbery1-Jun-09 17:09 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread [modified] Pin
Mark Salsbery1-Jun-09 14:13
Mark Salsbery1-Jun-09 14:13 
General[Message Deleted] Pin
fjparisIII1-Jun-09 16:39
fjparisIII1-Jun-09 16:39 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 17:06
Mark Salsbery1-Jun-09 17:06 
General[Message Deleted] Pin
fjparisIII1-Jun-09 17:56
fjparisIII1-Jun-09 17:56 
General[Message Deleted] Pin
fjparisIII2-Jun-09 4:40
fjparisIII2-Jun-09 4:40 
General[Message Deleted] Pin
fjparisIII2-Jun-09 5:33
fjparisIII2-Jun-09 5:33 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread [modified] Pin
fjparisIII2-Jun-09 6:24
fjparisIII2-Jun-09 6:24 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 6:36
Mark Salsbery2-Jun-09 6:36 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread [modified] Pin
fjparisIII2-Jun-09 7:00
fjparisIII2-Jun-09 7:00 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 6:43
Mark Salsbery2-Jun-09 6:43 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 6:45
Mark Salsbery2-Jun-09 6:45 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 6:29
Mark Salsbery2-Jun-09 6:29 
General[Message Deleted] Pin
fjparisIII2-Jun-09 7:52
fjparisIII2-Jun-09 7:52 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery2-Jun-09 8:07
Mark Salsbery2-Jun-09 8:07 
General[Message Deleted] Pin
fjparisIII2-Jun-09 8:22
fjparisIII2-Jun-09 8:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.