Tuesday 29 December 2015

Progressbar WPF

Hello everyone,

If you ended up in this page then that means you were looking for those words:
WPF + Powershell + Progressbar and not really satisfied with what you found on the web.

I mean, you began to write your code in powershell, choosed XAML because the render
was more prettier and we can apply very interseting visual theme.

There maybe another clean way to do this but after many hours of search on
the internet, I haven't found anything that was satisfying me.

So I come up with the idea to create my own, and in my great surprise, it worked. :)


So let's skip all the comment and go to the main subject:
The Problem is:
--> The progressbar won't refresh no matter what. That's normal because powershell handles one process at a time. It waits that one task is finished before starting another one. It means that you cannot update you form unless your process is finished.
--> So what what we need to do is to create another process (a runspace to be more precise) to launch our progressbar.





In this example :

- The main process handles our progressing stuff (a loop from 0 to 100 here, nothing really extraordinary)
- The runspace (launch a modal window which contains our Progressbar and some Label)




    

Share:

0 commentaires:

Post a Comment

Popular Posts

Join us on Facebook

STATS

Contact Form

Name

Email *

Message *