Fluid and multithreading

Jan 9, 2010 at 10:16 AM


Hi all,

I have a tricky question for the Fluid pros out there.

I have an application that uses some worker threads to get data from a server in the background and inserting it into a binding list assigned to a FLuidListBox. To make it all consistend I overwrote the OnListChanged method of the BindingList to be invoked in the GUI thread if needed about like this:

        protected override void OnListChanged(ListChangedEventArgs e)
            if (FluidHost.Instance.InvokeRequired)
                FluidHost.Instance.Invoke(new OnListChangedInvoker(OnListChanged), new object[] { e });

By subscribing to the ListChanged Event and invalidating the item on a ItemAdded type of change event I update the list of new items. This all works flawlessly so far.

My problem now is, that I have some other events that may trigger a MessageDialog that uses the ShowModal method for the ModalBackground. If during the MessageDialog the Worker Threads are updating my list the MessageDialog dissappars and gets 'overpainted' by the List again. However the input control seems to stay assigned to MessageDialog, as I can't click scroll the list any more. It is like frozen (but not really). When the dialog gets closed again the List gets clickable again.

So my big question is, how can I display something modal with Fluid that stays on top and painted even if something else gets updated below.

The following things are no acceptable solution for my scenario:

  1. Suspending the worker threads. (they need to be active all the time)
  2. Adding a Modal Background to the Panel where the list is in and display it via "visible=true" (this works but I need to be able to do a 'showmessage' like thingy from anywhere in the programs - also from within the plugins)

I hope someone has an idea as I am out any.