How Can I Modularize My WPF and PowerShell GUI Button Click Logic?

0
1
Asked By TechWanderer42 On

I'm working on updating a ping script at my job, moving from WinForms to WPF. As part of this, I'm learning to use runspaces to ensure the GUI stays responsive during heavy processes. Currently, I've got all the logic packed into button click events, and I'm wondering:
1. Am I overloading the controller with too much logic?
2. Should I break these down into functions for better organization?
3. If so, how should I go about doing that?

I plan on having at least two runspaces activated by UI events, each requiring unique functions and variable injections. I've looked for guidance but haven't found much solid advice. I've shared some of the code snippets below to illustrate what I'm working with.

1 Answer

Answered By DevGuru99 On

I've tackled similar GUI PowerShell projects before, and I really suggest you consider converting this into a C# application that uses PowerShell for the existing scripts. It simplifies managing multi-threading and boosting responsiveness, plus you still get to use the code you already have written. It's a bit of a leap, but worth it!

SyncNut1 -

But I don’t know anything about C#. Is it really tough to learn? And if I switch, how hard would it be to share the script with my teammates? I thought about Python, but I hit some walls with interpreter issues on our VMs.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.