|
6 | 6 | using System.Diagnostics; |
7 | 7 | using System.Threading; |
8 | 8 | using System.Threading.Tasks; |
9 | | -using System.Windows.Threading; |
10 | 9 | using AlphaChiTech.Virtualization.Pageing; |
11 | 10 | using AlphaChiTech.VirtualizingCollection; |
12 | 11 | using AlphaChiTech.VirtualizingCollection.Interfaces; |
@@ -163,9 +162,10 @@ public VirtualizingObservableCollection( |
163 | 162 |
|
164 | 163 | protected VirtualizingObservableCollection() |
165 | 164 | { |
166 | | - //To enable reset in case that noone set UiThreadExcecuteAction |
| 165 | + // If no one set the UiThreadExcecuteAction, we have to run actions on whatever thread we happen to be on. |
| 166 | + // We definitely CANNOT pull in a platform-specific implementation -- that would break other platforms... |
167 | 167 | if (VirtualizationManager.Instance.UiThreadExcecuteAction == null) |
168 | | - VirtualizationManager.Instance.UiThreadExcecuteAction = a => Dispatcher.CurrentDispatcher.Invoke(a); |
| 168 | + VirtualizationManager.Instance.UiThreadExcecuteAction = action => action(); |
169 | 169 | } |
170 | 170 |
|
171 | 171 | #endregion Ctors Etc |
@@ -633,21 +633,9 @@ internal void RaiseCollectionChangedEvent(NotifyCollectionChangedEventArgs args) |
633 | 633 | { |
634 | 634 | var handler = (NotifyCollectionChangedEventHandler) @delegate; |
635 | 635 |
|
636 | | - // If the subscriber is a DispatcherObject and different thread. |
637 | | - var dispatcherObject = handler.Target as DispatcherObject; |
638 | 636 | try |
639 | 637 | { |
640 | | - if (dispatcherObject != null && !dispatcherObject.CheckAccess()) |
641 | | - { |
642 | | - // Invoke handler in the target dispatcher's thread... |
643 | | - // asynchronously for better responsiveness. |
644 | | - dispatcherObject.Dispatcher.BeginInvoke(DispatcherPriority.DataBind, handler, this, args); |
645 | | - } |
646 | | - else |
647 | | - { |
648 | | - // Execute handler as is. |
649 | | - handler(this, args); |
650 | | - } |
| 638 | + handler(this, args); |
651 | 639 | } |
652 | 640 | catch (Exception ex |
653 | 641 | ) //WTF? exception catch during remove operations with collection, try add and remove investigation |
|
0 commit comments