Questions on using Runspace for multi-threading
hi,
i have been following tutorial here:
http://newsqlblog.com/2012/05/22/concurrency-in-powershell-multi-threading-with-runspaces/
it not clear me how add functionality fired on button click new thread. when user click button, want function fire , should run in it's own runspace not lock gui.
i have created 3 runspaces in tutorial.
now, when user clicks button, need again create following:
$pipeline2
=
[system.management.automation.powershell]
::create()
$pipeline2
.runspacepool =
$pool
$pipeline2
.addscript(
$scriptblockbuttonclick
)
is required or else? each runspace, need create new variable $pipeline2, $pipeline3 etc ,
assign [system.management.automation.powershell]
::create() it. how differentiate between
which runspace using, in case 1, 2 or 3?
thanks lot.
thanks. need clarification on of code on page please.
$synchash.textbox = $synchash.window.findname("textbox")
how line work? in xaml have:
<textbox x:name = "textbox" height = "400" width = "600"/>
is $synchash.textbox referring <textbox x:name ? if
you if wanted add textfield , call different x:name:
<textbox x:name = "textbox2" height = "400" width = "600"/>
it's confusing because appears referring same object set itself? these different threads?
thanks!
the first line showing how connect textbox control name 'textbox' (this case sensitive) , stores control in hash table.
yes, if wanted add control, give unique name , load did first example.
this same thread, hash table holding of wpf controls easier handle them across different threads.
boe prox
blog | twitter
poshwsus | poshpaig | poshchat | posheventui
powershell deep dives book
Windows Server > Windows PowerShell
Comments
Post a Comment