imagelistButtonBusyAnimation

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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: imagelistButtonBusyAnimation

Post by jvierra »

Sorry. I guess I posted the older version.

Here is the more explicit version:

Code: Select all

Add-JobTracker -Name 'GetFiles' `
        -ArgumentList $env:windir `
	-JobScript {
		Param($Path)
                Get-ChildItem $Path -Recurse -ErrorAction SilentlyContinue
	}`
	-CompletedScript {
I moved the "Arguments" parameter to the top so it is easier to manage. Delete it at the end and don't forget to remove the line extender.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: imagelistButtonBusyAnimation

Post by jvierra »

I have never liked the original layout of the code. This is how I build because it is easier to see what is happening and it is easier to maintain. I have a custom control set that is modified to do this.
Attachments
Demo-SimpleJobTracker.psf
(26.69 KiB) Downloaded 93 times
User avatar
SvanGool
Posts: 37
Last visit: Mon Nov 27, 2023 2:02 am

Re: imagelistButtonBusyAnimation

Post by SvanGool »

With the help of you last example its is working!
Thanks
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: imagelistButtonBusyAnimation

Post by jvierra »

Once you get the flow and structure it is pretty easy however ....

If you have too much code in the "Update" script it may also freeze the UI or make it sluggish. Simple text output to a text control is not a problem but more complex output to more complex controls can cause UI issues.

Here is a second example of incrementally loading a DGV from a job.
Attachments
Demo-SimpleDGVJobTracker.psf
(22.87 KiB) Downloaded 103 times
This topic is 6 years and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked