|
You can't do it unless you have the source code to the external process you're trying to run, and even then, it's going to be a pain in the ass.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
You can't show progress of the application but you can have a label which says work in progress while the bat file is running and than inform user when the bat file exits.
|
|
|
|
|
Or if he wants, a progress bar that recycles itself controlled by a BackgroundWorker .
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
thank you, both of your suggestion are useful and can apply, but i have an option too: the batch file launches in sequence DISKPART (along with several SELECT DISK, SELECT PARTITION, FORMAT, etc commands) and IMAGEX:
both of them returns some messages, imagex in particular updates a percentual progression indicator.
Could i redirect these messages to the frontend?
|
|
|
|
|
Usually not. They're usually dispaly using non-stream methods that your code would not be able to intercept or would be very difficult to process with any meaning.
A better option would be to get rid of the batch file and execute each command from your background worked. When you go from one step (command line) in the batch file to the next, you can update the progress bar. Keep in mind you will NOT be able to increment progress inside each of those steps.
|
|
|
|
|
Well this is just an idea ... you could use the Process.StandardOutput to get data from the cmd window(in which the bat runs) ... then you would have to output some "marks" from the .bat file in order to "signal" an update to the state of how far the things have gone. Check Process.StandardOutput on MSDN documentation.
|
|
|
|
|
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
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
|
|
|
|
|
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)
(><)
|
|
|
|
|
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)
(><)
|
|
|
|
|
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)
(><)
|
|
|
|
|
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)
(><)
|
|
|
|
|
glad to be here, i'm learning alot from cp!
|
|
|
|
|
here is the EventHandler
public void ClickEventHandler(object sender, EventArgs e)
GetMethod by name
MethodInfo mi = type.GetMethod("ClickEventHandler");
and i need a EventHandler object for my other fucntion parameter
how could i convert this "mi" to a type of EventHandler
|
|
|
|
|
Do you really need to get the delegate from a string?
Just use the name ClickEventHandler as an identifier, and the compiler will identify it as an EventHandler delegate.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
When I upload any Text File through Fileupload control in Visual Studio 2005 in Asp.net 2.0 with C#.net 2.0. When I download or open the same file the actual content and the html content of the aspx page is displayed. How to get the actual content of the file when opening or saving the file.
|
|
|
|
|
I assume that you are using Resonse.WriteFile or Response.BinaryWrite to send the file in the response? Remove all markup from the aspx file except the @Page directive.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Why dont you post this question the ASP.Net forum?? You may get more answers.
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
actually i m trying to make such an application which is distributed on different computers
over a network, i want that database should be on one computer ,all users can access it from there.
but different users have different rights .
for exmple : an organizaion having many departments like Accounts, Finance,HR,Sale,IT and so on.
now different users are available.
like HR manager doing some different task and Accounts manager doing differnt.
different departments are join together through networking .
how can i doing this?
Maifs
|
|
|
|
|
The answers you seek are covered by entire college courses and entire books. You will not get answers to these broad questions in a couple of forum posts.
I suggest picking up some books and do research on "Enterprise Software Development" and "N-Teir Development". "Patterns and Practices[^]" would also be a good place to start. There's thousands of pages of documentation and discussion on creating just such applications.
|
|
|
|
|