Unusual approach for rapid development of GUI application, will it work?

Greetings,

The application will have a lot of file/folder/extract/download/executing simple shell commands operations. My main concern is the fact that I will spend way to much time if I will try to write all those operations using c#. I know Powershell and I know that I could write all all ‘base’ operations scripts very quickly, instead of reinventing wheel.

So I came up with the idea that I would like to write c#-based application with will:

  • use Powershell as much as possible for file/extracting/downloading/executing/other OS things
  • use WPF as GUI Framework because it’s rock-solid technology ( no cross-platform WPF like yet)
  • use c# to connect output of the powershell commands with GUI logic for controls like Buttons, TextBox, Tabbed TreeView, Tabbed DataGrid and of course Labels

Later, I would try to make application more responsive using ReactiveUI or something similar or replace WPF with upcoming Xamarin WPF in order to make this app to be accessible for Desktop Mac OS and Linux ( no need mobile), but let’s skip future plans for now.

I would like to receive feedback from someone who used c# to execute Powershell scripts. So far I was able to successfully include creating PS Runspace inside c#, executing commands and take single output as data for other things. But I get lot of object type mismatch and somehow It doesn’t look so flexible as I thought.

So what’s you opinion about such approach? Will it work? Or maybe it won’t save time because I would have to deal with two languages at once?

I have written just a couple of PS GUI apps, my suggestion is, stick to one language.

Is there a reason you have to use C# as the base? It is possible to write a PowerShell based WPF app as well. You might look here at a great start, https://foxdeploy.com/series/learning-gui-toolmaking-series/.

I have been doing multi-threaded PowerShell apps for a couple of months straight. Some have had very little user interaction where others were more like a wizard experience. It’s worked out great and since you stay in PowerShell, it’s pretty convenient for accessing information across runspaces even.

I tend to think simpler is better, so if there is no reason that you have to call PowerShell from C#, I would avoid it. There’s bound to be hours of figuring out why something didn’t function as expected because of the integration between the two languages. I could be wrong, but that’s my thought.

I have been doing multi-threaded PowerShell apps for a couple of months straight. Some have had very little user interaction where others were more like a wizard experience. It's worked out great and since you stay in PowerShell, it's pretty convenient for accessing information across runspaces even.

That’s exactly the expertise/personal experience which I wanted to hear. Thank you!