Re: I wanna implement the revolving slash while the process is executing
- From: Peter Duniho <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Fri, 27 Jul 2007 17:10:43 -0700
antonyliu2002@xxxxxxxxx wrote:
I have a Windows console application, which takes around 3 minutes to
complete the execution.
I am interested in implementing something animate while users are
waiting for the process to complete.
If you have experience with Linux/Unix, you should be very familiar
with the revolving slash ( / ) or the growing dots ( ...... ), which
you normally see, when a process is taking some time.
I guess I may have to implement 2 threads. One does the real dirty
work behind, the other displays the revolving slashes (maybe it is a
combination of --, / and \) or grows the dots.
Any idea how to implement this fun stuff? Thanks.
How fancy do you want?
Here's a simple example:
static void Main()
{
Thread thread = new Thread(ThreadStart(DoWork));
char[] rgchBusy = new char[] { '-', '\', '|', '/' };
int ichBusy = 0;
thread.Start();
// The thread that does the work will set WorkDoneWaitHandle,
// an instance of a WaitHandle, when it's done.
while (WorkDoneWaitHandle.WaitOne(1000))
{
Console.WriteLine("\r" + rgchBusy[ichBusy]);
ichBusy = (ichBusy + 1) % rgchBusy.Length;
}
}
.
- Follow-Ups:
- Re: I wanna implement the revolving slash while the process is executing
- From: antonyliu2002@xxxxxxxxx
- Re: I wanna implement the revolving slash while the process is executing
- References:
- I wanna implement the revolving slash while the process is executing
- From: antonyliu2002@xxxxxxxxx
- I wanna implement the revolving slash while the process is executing
- Prev by Date: Re: I wanna implement the revolving slash while the process is executing
- Next by Date: Bug in framework 2.0
- Previous by thread: Re: I wanna implement the revolving slash while the process is executing
- Next by thread: Re: I wanna implement the revolving slash while the process is executing
- Index(es):
Relevant Pages
|