Send multi messages to Dockpane

412
2
12-29-2021 11:55 PM
mody_buchbinder
Occasional Contributor III

A quick question before the new year..

I have a button on Dockpane that runs a few geoprocessing tools that takes some time.

I added a label to the dockpane and I would like to send messages as the process move forwards (just like in the gp results window).

After each step I use:

_message = "Mody";
NotifyPropertyChanged(() => message);

but the dockpane update only when all the process ends.

Putting a MessageBox after each change makes the dockpane update but it is blocking the process - that is what I try to avoid.

I could not find any way to refresh/sync the dockpane to get the messages while the process continue.

Happy new year

Mody

0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

Hi, 

Have you tried this (best-way-to-show-progress) using Dispatcher?

0 Kudos
mody_buchbinder
Occasional Contributor III

 

The code below works for me...

       private async Task DoSend()
        {
            await QueuedTask.Run(() => {
                _message = "first message";
                NotifyPropertyChanged("message");

                System.Threading.Thread.Sleep(1500);
                // do something....
                _message = "second message";
                NotifyPropertyChanged("message");

            });
        }

 

0 Kudos