GUI is painfully slow

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 2 years and 4 months 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
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Re: GUI is painfully slow

Post by Alexander Riedel »

What my comment with moving it outside the event handler implied, was to run it outside the event handler. Just moving the code to another function and calling that from the event handler would not change anything. I know James, he was certainly not intent on being condescending. He just states facts as he sees them. Forums, like email, suffer from emotions being interpreted by the reader rather than the writer.
Please do not assume anyone wants to be "less than helpful". I fell into that trap often enough myself to know :D

If you have an hour or more long process to churn over data, put it in a separate process. Monitor the process and provide an estimated time until completion if you can. If not, provide a status of running or not.
The user does usually not need to know if something is finished in 55 minutes or an hour and 5. Commonly a WAG is enough to indicate "Yes you can go for lunch" or "Take a coffee break"
If there is an option to cancel and resume / restart later, that would be helpful to most users.
Alexander Riedel
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: GUI is painfully slow

Post by jvierra »

JProvencher wrote: Wed Nov 03, 2021 12:05 pm Thank you for your condescension. I've been coding in PowerShell for a few years now but have never worked with GUIs.

Alex had said that moving it outside the event handler would help.

Your curt reply was very much less than helpful.
I am sorry that I seem to have confused you further.

Asking someone to review a technology is quite normal. I have returned to fundamentals repeatedly. The one thing I learned early in my engineering career was that we never seem to know enough and that thinking that we have ALL of the required information tends to lead to failure.

It is clear that you have no GUI experience. The book I recommended would give you a head start on using a very advanced and complex technology that just simple batch style scripts wouldn't give you. Since you have some basic PowerShell then the book would really accelerate your knowledge and skills.

Just moving code3 around between files does not change how the code is executed. In WIndows and most modern systems code is executed due to a complex event chain. With WinForms this is absolutely the case. Since PowerShell only has one thread then any code that "blocks" by taking a long time to execute will totally block all events from being processed.

The article links from Alex will explain this in more detail. The book link will give you more options on how to proceed with WinForms and all future coding attempts.

I have read hundreds of books on coding and systems design even though I learned coding from the ground up starting in 1964. Lear5ning for techs never ends. We never know enough and seldom learn more until we have a new challenge to solve.

Sorry for the confusion, good luck.
User avatar
JProvencher
Posts: 13
Last visit: Wed May 03, 2023 11:49 am

Re: GUI is painfully slow

Post by JProvencher »

Thanks. I've downloaded the book and just need to find time to go through it.
You started coding in '64? I was born in '64. Neither of us are young, and I think I definitely learn a little differently than when I started out, in the US Navy back in '83. I've always used scripting of some type, even if it was to only make my job easier. More often than not, it is a learning exercise.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: GUI is painfully slow

Post by jvierra »

Any scripting is a good background except that, in Windows, the system is now a modern event driven system and long scripts won't work well with event driven systems when there is only one thread of execution. Learning how that causes a difference in how you approach designing a solution makes it much easier to see how to design for a threaded event-driven system.

The book will get you the groundwork for that. Take it slowly and try not to skim. Missing small details in a modern system can cause you to get lost and stuck often.

I continue to return to the docs with modern systems and APIs because it is impossible to remember the tens of thousands of possible properties, events, methods and objects.
HueyHuey1
Posts: 3
Last visit: Thu Dec 16, 2021 7:00 am

Re: GUI is painfully slow

Post by HueyHuey1 »

The graphical interface is something new for me. It's interesting
HueyHuey1
Posts: 3
Last visit: Thu Dec 16, 2021 7:00 am

Re: GUI is painfully slow

Post by HueyHuey1 »

Please tell me how did you download the book?

Thank you!
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: GUI is painfully slow

Post by jvierra »

I posted the link in a previous post.


https://www.sapien.com/books_training/W ... werShell-4
This topic is 2 years and 4 months 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