dispatcher

AS3: Can I dispatch Event from one Child to another?

十年热恋 提交于 2019-12-11 06:44:34
问题 Hi guys, I cannot sort out this enigma :). How to send dispatchEvent from Child1 and catch this event in Child2? or How to send dispatchEvent from Child1 and catch this event in Child3? or How to send dispatchEvent from Child3 and catch this event in Child1? Thanks guys. I will appreciate some help here! 回答1: Although I get what you are trying to achieve, I think the better design approach is to allow the container to manage it's children. For example if container receives an event from

SelectedIndex is unchanging in tabcontrol - Dispatcher issue

為{幸葍}努か 提交于 2019-12-11 06:24:53
问题 Why, after I set SelectedIndex=0, do I subsequently (not in response) get the event handler invoked with SelectedIndex=4? I traced it down to an invocation of a Dispatcher, but I do not understand why. Here's the plan: I have a page containting a tab control with assorted tabs. When I click on certain kinds of tabs, I want to switch out of this page to another page. The trouble is, when I return to this page, I'm getting looped back out to the other page again, and I can't figure out why.

Alternative of Dispatcher class (from .net 3.0) to use in .net 2.0 context

老子叫甜甜 提交于 2019-12-11 04:46:47
问题 I need an alternative for Dispatcher (.net 3.0) to use for a windows service (done in .net 2.0). Can you give me some idea how to achieve something like that or point me some links? I know that a dispatcher has a SynchronizationContext behind, but I don't know how I can use a SynchronizationContext into a service. If you think that I should stick to the Dispatcher (.net 3.0) ... how can I manipulate it ( OnServiceStop , OnServiceStart ) edited: More details (see also...here) Idea is that I

How to force dispatcher cache urls with get parameters

↘锁芯ラ 提交于 2019-12-11 04:08:03
问题 As I understood after reading these links: How to find out what does dispatcher cache? http://docs.adobe.com/docs/en/dispatcher.html The Dispatcher always requests the document directly from the AEM instance in the following cases: If the HTTP method is not GET. Other common methods are POST for form data and HEAD for the HTTP header. If the request URI contains a question mark "?". This usually indicates a dynamic page, such as a search result, which does not need to be cached. The file

How to update a WPF Control from the TPL Task?

强颜欢笑 提交于 2019-12-11 01:33:33
问题 How to update a WPF Control from the TPL Task? Fine so I tried some scenarios to use Dispatcher but anyway it gives the error. I need help guys! private void Window_Loaded(object sender, RoutedEventArgs e) { //Application.Current.Dispatcher.Invoke((Action)MyInit); backgroundDBTask = Task.Factory.StartNew(() => { DoSomething1(); }, TaskCreationOptions.LongRunning); backgroundDBTask.ContinueWith((t) => { // ... UI update work here ... }, TaskScheduler.FromCurrentSynchronizationContext()); }

Unit testing something with ObserveOnDispatcher

拈花ヽ惹草 提交于 2019-12-11 00:13:25
问题 I've some code in my view model as follows: miService.GetSomething(par1, par2) .ObserveOnDispatcher() .Subscribe(dt => { DoSomething(dt); }); Then in my test, I'm "mocking" my service as follows: miService.Setup(ms => ms.GetSomething(....)) .Returns(Observable.Return(XYZ)); The problem is that due to the ObserveOnDispatcher, the subscribe delegate is never executed. I've seen some code with DispatcherFrame and PushFrame, but the problem is that I don't know "where", I can call frame.Continue

Datagrid binding (WPF) causing UI delay

社会主义新天地 提交于 2019-12-10 23:34:02
问题 I want to be able to add items to a Data grid at a fast rate without causing UI delay. Here is what I am doing now: I am using an ObservableCollection that is bound to the data grid. I use a background thread that loops and calls Invoke on the current dispatcher only when inserting/removing from the observable collection. Calling BeginInvoke instead has undesirable results. I know that invoking that much on the dispatcher is causing the delay but I don't know what else to do. I have used

WPF: Passing objects between UI Thread and Background thread

本小妞迷上赌 提交于 2019-12-10 23:04:30
问题 In my Window constructor after InitializeComponents, I need to create an object and bind it to a datagrid. Since the object creation is taking too much time, the windows takes a while to show up. So I decided to move the creation of the object to a background thread and "delegate back" to the UI thread by doing a dispatcher.invoke to perform the binding. But this fails. The weird thing is if I try to set the visibility of a rectangle I have inside the Dispatcher.invoke, that works but the

WPF framework using Dispatcher.CurrentDispatcher in background thread, causing memory leak

独自空忆成欢 提交于 2019-12-10 22:49:53
问题 I'm using a WPF CollectionView and I'm setting the Filter in a background thread, because it takes a long time to apply this filter. Setting this Filter triggers the method ScheduleMapCleanup() of CollectionView (so WPF framework code I can't change). In this method, Dispatcher.CurrentDispatcher.BeginInvoke is used. However, because this is executed in a background thread, this Action is never executed (the Dispatcher of this thread is never started), causing a memory leak: The Dispatcher

When is the GUI overloaded?

ぐ巨炮叔叔 提交于 2019-12-10 22:17:22
问题 Suppose you are permanently invoking a method asynchronously onto the UI thread/dispatcher with while (true) { uiDispatcher.BeginInvoke(new Action<int, T>(insert_), DispatcherPriority.Normal, new object[] { }); } On every run of the program you observe that the GUI of the application begins to freeze after about 90 seconds due to the flood of invocations (time varies but lies roughly between 1 and 2 minutes). How could one exactly determine (measure ?) the point when this overloading occurs