15,910,981 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by claudiu2323 (Top 6 by date)
claudiu2323
5-Aug-12 5:14am
View
I'm sorry, but it does not work. It gives the same error and situation as before.
claudiu2323
25-Jul-12 8:47am
View
It just might. I can't try it out right now, but hopefully I'll test it in a few days. Anyway, thank you all for the answers. Post it as a solution, so I can accept it if it works.
claudiu2323
22-Jul-12 16:28pm
View
Well, TFileInfo is a DependencyObject, so I just get it's member Dispatcher (TFileInfo.Dispatcher);
Second, the line above ( f.Dispatcher.Invoke(new Action<bitmapsource,>((b, t) => t.Thumb = b), bs, f); )
continues to the invocation, then while on the main thread, the UI thread, where supposedly I should be able to access my object, that DependencyProperty Setter internally calls VerifyAccess, after a series of calls (I have shown the list earlier) which declares an OperationInvalidException, as stated previously. It seems irrational, because when I set the DependencyProperty directly from the main (UI) thread, it works flawlessly, however, when I set it after calling Invoke/BeginInvoke from another thread, it throws this nasty piece of craft Exception. Am I doing it wrong ?
claudiu2323
20-Jul-12 11:41am
View
Also, this is the stack trace from the exception details window:
at System.Windows.Threading.Dispatcher.VerifyAccess()
at System.Windows.Controls.Image.OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp)
at System.Windows.Data.BindingExpressionBase.Invalidate(Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean dependencySourcesChanged, Boolean initialValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
at MS.Internal.Data.PropertyPathWorker.OnDependencyPropertyChanged(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
at MS.Internal.Data.ClrBindingWorker.OnSourceInvalidation(DependencyObject d, DependencyProperty dp, Boolean isASubPropertyChange)
at System.Windows.Data.BindingExpression.HandlePropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.Data.BindingExpression.OnPropertyInvalidation(DependencyObject d, DependencyPropertyChangedEventArgs args)
at System.Windows.DependentList.InvalidateDependents(DependencyObject source, DependencyPropertyChangedEventArgs sourceArgs)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at BiblioRap.TFileInfo.set_Thumb(BitmapSource value) in C:\Users\Red Cat\Desktop\bibliorap\TFileInfo.cs:line 94
at BiblioRap.PicGetter.<Thu>b__0(BitmapSource b, TFileInfo t) in C:\Users\Red Cat\Desktop\bibliorap\TFileInfo.cs:line 52
claudiu2323
20-Jul-12 11:36am
View
But you see, I am trying to cause the UI to call a delegate in the UI Thread through Dispatcher.Invoke:
f.Dispatcher.Invoke(new Action<bitmapsource, tfileinfo="">((b, t) => t.Thumb = b), bs, f);
Am I doing something wrong ?
claudiu2323
20-Jul-12 11:26am
View
Because I am invoking it on the Thread it was created on, so it shouldn't say otherwise.
Show More