Click here to Skip to main content
15,910,981 members

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 ?