GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.
User avatar
angelofstealth
Posts: 37
Joined: Wed Feb 13, 2013 4:26 pm

Re: GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Post by angelofstealth » Thu May 11, 2017 1:16 pm

Nevermind i found where they are and how to access them, sorry about that.

User avatar
angelofstealth
Posts: 37
Joined: Wed Feb 13, 2013 4:26 pm

Re: GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Post by angelofstealth » Wed May 17, 2017 5:56 am

Sorry for the delay in response,

jvierra,
Based on looking at the imported control set, i have implemented it into my code. Back to my previous question about the properties for a control: In the PSS application if a user selects and sets a property manually through the properties pane is that information stored anywhere within the code of the form/project? Adding a built in controlset is great but doesn't give you the full settings applied to a control. I have attached my updated code/project/test, added logging and user notification to better understand if something breaks. Thanks,
Attachments
MainForm.psf
(73.25 KiB) Downloaded 8 times

User avatar
jvierra
Posts: 11476
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Post by jvierra » Wed May 17, 2017 6:07 am

You can create a new base control and compare it with the user control.

User avatar
angelofstealth
Posts: 37
Joined: Wed Feb 13, 2013 4:26 pm

Re: GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Post by angelofstealth » Wed May 17, 2017 6:50 am

Okay sounds good, so it is manual then. Thanks

User avatar
jvierra
Posts: 11476
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Post by jvierra » Wed May 17, 2017 7:09 am

Code: Select all

PS>$b = [System.Windows.Forms.Button]::new()
PS>$b.Location

IsEmpty X Y
------- - -
True 0 0


PS>$b.Bounds


Location : {X=0,Y=0}
Size : {Width=75, Height=23}
X : 0
Y : 0
Width : 75
Height : 23
Left : 0
Top : 0
Right : 75
Bottom : 23
IsEmpty : False



PS>$b.Size='50,200'
PS>$b.Bounds


Location : {X=0,Y=0}
Size : {Width=50, Height=200}
X : 0
Y : 0
Width : 50
Height : 200
Left : 0
Top : 0
Right : 50
Bottom : 200
IsEmpty : False

Code: Select all

PS>$b2 = [System.Windows.Forms.Button]::new()
PS>$b.Location = '30,50'
PS>compare $b $b2 -Property size,location,text,name


size : {Width=75, Height=23}
location : {X=0,Y=0}
text :
name :
SideIndicator : =>

size : {Width=50, Height=200}
location : {X=30,Y=50}
text :
name :
SideIndicator : <=

User avatar
angelofstealth
Posts: 37
Joined: Wed Feb 13, 2013 4:26 pm

Re: GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Post by angelofstealth » Fri May 19, 2017 9:28 am

Thanks jvierra, that helps a lot to understand the differences between the controls.

Question:

I am using the Add-tracker to go run a scriptblock which is pulling computer info remotely. If I want to pull from multiple computers should I only use one add-tracker and then in the scriptblock control the foreach computer loop. Or use the foreach loop and call the add-tracker within it to run. I think i should use separate trackers with different Jobs names and then wait for all jobs to complete, update form controls.

User avatar
jvierra
Posts: 11476
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Post by jvierra » Fri May 19, 2017 9:41 am

The answer to that is completely up to you. It is a design consideration that cannot be made outside of knowing what you are trying to accomplish and what your design criteria are.

User avatar
angelofstealth
Posts: 37
Joined: Wed Feb 13, 2013 4:26 pm

Re: GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Post by angelofstealth » Fri May 19, 2017 1:16 pm

What I am trying to understand is if i created a bunch of jobs for the Add-Jobtracker through a loop, how will the form stop from freezing or waiting to update the controls until all the jobs are done. If I use get-job | wait-job after my loop/added trackers, it seems i have a unresponsive form. If I do one computer object with one job i have no issue, want to let you know i do have that working. Understand the multithreading/multi jobs being done without freezing the form. Throwing this out there, don't know, would i use a add-jobtracker to then call on the computer objects loop which will in turn run the multiple job trackers.

Example:
$Computers = (Get-Content C:\Computers.txt)
Foreach ($Computer in $Computers)
{
$rlts = "ComputerInfo-$a"
Add-JobTracker -Name $rlts -JobScript $jobscript -CompletedScript $completedscript -UpdateScript $updatescript -ArgumentList $a, $b
}

Routine/high level:
1) read in a list of computer objects
2) Add to tracker and run script on local computer,
3) After each job completes it update arrays with the values in compeletdscript
4) Once all jobs are done updated datagrids with arrays full of all the data from the jobs.

User avatar
jvierra
Posts: 11476
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: GUI: Progress Multiple Com Objects/Progress Bar - Responsive Form

Post by jvierra » Fri May 19, 2017 1:39 pm

I can only recommend that JobTracker handles all of your concerns and can manage multiple jobs. Please read the full articles on JobTracker. They do a very good job of explaining how it works and how to use it.

If each script is lengthy then use multiple jobs. If the script is very short then one job. If there are a large number of computers then use multiple jobs.

Also study "Workflow" to see how to parallelize many computers in a single job.

help about_workflows

Locked