The most successful I've been with that in PowerShell was when I used the
dispatcher timer to update the UI.

The basic idea was to have a synchronized hash table that would exist
between all the runspaces. I could then store information there for the UI
elements and the dispatcher timer would update the UI elements if it saw
the hashtable change.

There's also the ability to use the dispatcher to directly update UI
elements from a separate thread, but it isn't very optimized in PowerShell.
It's fine for one-offs, but if you do a lot of calls with it your script
will slow down.

I'm trying to think if I have example code somewhere. I'll look for some
after dinner.

On Wed, Mar 15, 2017 at 4:57 PM Mote, Todd <mo...@austin.utexas.edu> wrote:

> Ok, have a WPF form.  It looks pretty.  It runs in its own runspace.
> Awesome.  Now I’m trying to connect UI element actions output to the output
> box I’ve got.  I can update the outputbox fine from the main UI runspace
> using a nice little function using the dispatcher.  But as soon as I have
> an event fire, like combobox.add_selectionchanged, that I want runspaced so
> I can have the work it’s doing separated from the UI, I lose the ability to
> update the UI runspaces output text box.   I’ve tried everything that seems
> logical to me.  But the basic question is how can I edit the UI in a parent
> runspace from a child runspace?
>
>
>
> Todd
>
>
>
>
>
>



Reply via email to