Click here to Skip to main content
15,914,416 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: how to animate the button in sequencial mode ? Pin
Pete O'Hanlon2-Jun-09 2:11
mvePete O'Hanlon2-Jun-09 2:11 
GeneralRe: how to animate the button in sequencial mode ? Pin
Feras Mazen Taleb2-Jun-09 2:28
Feras Mazen Taleb2-Jun-09 2:28 
AnswerRe: how to animate the button in sequencial mode ? Pin
Feras Mazen Taleb2-Jun-09 21:04
Feras Mazen Taleb2-Jun-09 21:04 
GeneralRe: how to animate the button in sequencial mode ? Pin
Feras Mazen Taleb7-Jun-09 3:54
Feras Mazen Taleb7-Jun-09 3:54 
QuestionImage on Button Pin
Member 232448330-May-09 9:11
Member 232448330-May-09 9:11 
AnswerRe: Image on Button Pin
ABitSmart30-May-09 16:51
ABitSmart30-May-09 16:51 
AnswerRe: Image on Button Pin
Mark Salsbery31-May-09 8:14
Mark Salsbery31-May-09 8:14 
QuestionProblem executing BitmapDecoder.Save() in worker thread [modified] Pin
fjparisIII30-May-09 8:50
fjparisIII30-May-09 8:50 
I have developed code based on the following post that has been previously reference in this forum: http://blog.andreweichacker.com/2009/02/reading-and-writing-tags-for-photos-in-wpf/comment-page-1/#comment-1492[^]

The code that I have developed based on the above thread works 100% of the time if it is executed inside of the WPF main application thread. But it fails 100% of the time if it is executed inside of a worker thread. The code fails on BitmapEncoder.Save(), throwing a "Cannot write to the stream" exception. But I have to execute this code inside of a worker thread because I have to display a progress bar: I'm updating the Copyright metadata in a batch operation for thousands of images!

On a wild guess I thought that BitmapEncoder.Save() might be failing because it is derived from DispatcherObject. But when I call BitmapEncoder.CheckAccess() it returns true, which actually isn't surprising since the BitmapEncoder object is constructed inside the worker thread. So I don't see any reason why I can't execute BitmapEncoder.Save() in the worker thread, but when I try, the BitmapEncoder.Save() throws the exception.

This has been tormenting me for weeks and only today did I realize that what was different about the cases where my class worked and where it didn't is whether BitmapEncoder is instantiated inside a worker thread, and this restriction seems completely irrational to me. So my question is, what am I missing and how can I correct the problem? This problem is holding up a ton of work that I have to do.

modified on Saturday, May 30, 2009 3:03 PM

AnswerRe: Problem executing BitmapDecoder.Save() in worker thread (solved through egregious kludge) Pin
fjparisIII30-May-09 12:38
fjparisIII30-May-09 12:38 
AnswerRe: Problem executing BitmapDecoder.Save() in worker thread [modified] Pin
Mark Salsbery31-May-09 8:30
Mark Salsbery31-May-09 8:30 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII31-May-09 11:42
fjparisIII31-May-09 11:42 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery31-May-09 12:26
Mark Salsbery31-May-09 12:26 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII31-May-09 13:50
fjparisIII31-May-09 13:50 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII31-May-09 18:46
fjparisIII31-May-09 18:46 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery31-May-09 20:18
Mark Salsbery31-May-09 20:18 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII1-Jun-09 5:42
fjparisIII1-Jun-09 5:42 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 6:47
Mark Salsbery1-Jun-09 6:47 
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 

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.