BackgroundWorker and command line exe: what DoWork deals with?
-
This's how I would do it.. - If the process is well known to me, I would monitor something that it does all the time "like in the installation, the number of files it creates and the name of the final file created" and count those files while it's running and update my progress bar accordingly - If this's not an option, then this's why we have a dump loading animation :laugh:
All generalizations are wrong, including this one! (\ /) (O.o) (><)
i'm trying both these approaches ;) 1- i'm trying to use the wimgapi.dll to control the image restore 2- in the meanwhile i'll use a simply process.start and process.end for each of the .bat' step
-
This's how I would do it.. - If the process is well known to me, I would monitor something that it does all the time "like in the installation, the number of files it creates and the name of the final file created" and count those files while it's running and update my progress bar accordingly - If this's not an option, then this's why we have a dump loading animation :laugh:
All generalizations are wrong, including this one! (\ /) (O.o) (><)
i'm trying to monitor the total space written on disk, but that value is written only when process has completed and not while it's running: during the process execution, the GUI seems to be frozen. how could I get it up?
modified on Sunday, November 16, 2008 4:17 PM
-
i'm trying to monitor the total space written on disk, but that value is written only when process has completed and not while it's running: during the process execution, the GUI seems to be frozen. how could I get it up?
modified on Sunday, November 16, 2008 4:17 PM
Sorry mate, haven't tried that actually, but I could assume doing it by separating file stream writings and get the total free space left after closing the stream after writing each file of the process.
All generalizations are wrong, including this one! (\ /) (O.o) (><)
-
Sorry mate, haven't tried that actually, but I could assume doing it by separating file stream writings and get the total free space left after closing the stream after writing each file of the process.
All generalizations are wrong, including this one! (\ /) (O.o) (><)
Thanks Muammar, the write process is managed by a pure command line process, hence i cannot distinguish the streams.. The only option I have is to keep monitored the disk space being written, but the process.start is on the same thread than the GUI, hence the GUI is locked during the process. It gets refreshed only once the process ends. I'm trying a way to launch the command line process on a separate thread, keeping the GUI free to refresh.
-
Thanks Muammar, the write process is managed by a pure command line process, hence i cannot distinguish the streams.. The only option I have is to keep monitored the disk space being written, but the process.start is on the same thread than the GUI, hence the GUI is locked during the process. It gets refreshed only once the process ends. I'm trying a way to launch the command line process on a separate thread, keeping the GUI free to refresh.
Actually, it seems like you have to give up your current code and start off with a new clean and simple one, which simply loops in a background worker do_work method and in each loop you: 1. open a file stream 2. copy the file through it //instead of using a dull command-line copy (sorry!) 3. close the stream //so you have your hd unlocked to decide the new free space 4. get the new free space and do the math 5. submit that value to the status member of the background process 6. load the value from step 5 to your progress bar control Voala!
All generalizations are wrong, including this one! (\ /) (O.o) (><)
-
Actually, it seems like you have to give up your current code and start off with a new clean and simple one, which simply loops in a background worker do_work method and in each loop you: 1. open a file stream 2. copy the file through it //instead of using a dull command-line copy (sorry!) 3. close the stream //so you have your hd unlocked to decide the new free space 4. get the new free space and do the math 5. submit that value to the status member of the background process 6. load the value from step 5 to your progress bar control Voala!
All generalizations are wrong, including this one! (\ /) (O.o) (><)
i cannot loop any file writing: the command line process is imagex, that explode and apply a .wim image to the specified disk, it runs in a single instance, from start to end, and it takes approximately 20 minutes. Hence, the process cannot be subdivided.
-
i cannot loop any file writing: the command line process is imagex, that explode and apply a .wim image to the specified disk, it runs in a single instance, from start to end, and it takes approximately 20 minutes. Hence, the process cannot be subdivided.
Say, this's different than I thought, hmmm, I'm not sure... did you try getting the file size instead?? I think it would lead into the same thing after all. If I were you, I'd simply use a dull loading like the one I'm using here
All generalizations are wrong, including this one! (\ /) (O.o) (><)
-
Say, this's different than I thought, hmmm, I'm not sure... did you try getting the file size instead?? I think it would lead into the same thing after all. If I were you, I'd simply use a dull loading like the one I'm using here
All generalizations are wrong, including this one! (\ /) (O.o) (><)
thanks mate, i solved it instancing a separate thread.
-
thanks mate, i solved it instancing a separate thread.
LordZoster wrote:
separate thread.
It's embarrassing I missed that!!
LordZoster wrote:
thanks mate
No, thanks to you LordZoster! This is usually the most beautiful kind of posts here in the cp: when you fight to find an answer but eventually find it yourself and be generous enough to share the answer with everyone.. Thanks again mate, and welcome to the code project:) we're proud to have such people in here:)
All generalizations are wrong, including this one! (\ /) (O.o) (><)
-
LordZoster wrote:
separate thread.
It's embarrassing I missed that!!
LordZoster wrote:
thanks mate
No, thanks to you LordZoster! This is usually the most beautiful kind of posts here in the cp: when you fight to find an answer but eventually find it yourself and be generous enough to share the answer with everyone.. Thanks again mate, and welcome to the code project:) we're proud to have such people in here:)
All generalizations are wrong, including this one! (\ /) (O.o) (><)
glad to be here, i'm learning alot from cp!