473,321 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Long activity indicator control

Hi

I have a winforms application developed in c# v1.1.
The application has a form that calls a webservice method. The call is
performed from inside the GUI thread and may take up to a minute.
Meanwhile, I want to provide to the user some sort of visual indicator
indicating that the application is not frozen.
The call to the WS should remain on the GUI thread, as I don't want
the user to manipulate other visual controls while the call is in
effect.
I don't need to display a progress bar, just some sort of a dynamic
image like this:
https://marketplace.slizone.com/SliM...es/loading.gif
or another user control that plays some dynamic content.
Any idea how to perform this?
Thanks.

Nov 12 '07 #1
10 5270
On Nov 12, 3:22 pm, nano2k <adrian.rot...@ikonsoft.rowrote:
I have a winforms application developed in c# v1.1.
The application has a form that calls a webservice method. The call is
performed from inside the GUI thread and may take up to a minute.
Doing that on a GUI thread is not a good idea.
Meanwhile, I want to provide to the user some sort of visual indicator
indicating that the application is not frozen.
The call to the WS should remain on the GUI thread, as I don't want
the user to manipulate other visual controls while the call is in
effect.
Then disable those controls while the operation is in progress. You
shouldn't make a long-running call on the UI thread.
I don't need to display a progress bar, just some sort of a dynamic
image like this:https://marketplace.slizone.com/SliM...es/loading.gif
or another user control that plays some dynamic content.
Any idea how to perform this?
I would seriously look at disabling all controls on the UI thread, and
then making the call elsewhere, updating the UI with a progress
indicator (of any kind, whether that's an image or not) appropriately.

I know it's a pain, but locking up the UI thread for a minute is a
really bad idea.

Jon

Nov 12 '07 #2
As an add-on to what Jon indicated (good advice), you can put an animated gif
into a picturebox control and turn on the Visible property when the call is
made. When results come back, you make the pic invisible. But you do not want
to make your webservice call from the UI thread.
-- Peter
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"nano2k" wrote:
Hi

I have a winforms application developed in c# v1.1.
The application has a form that calls a webservice method. The call is
performed from inside the GUI thread and may take up to a minute.
Meanwhile, I want to provide to the user some sort of visual indicator
indicating that the application is not frozen.
The call to the WS should remain on the GUI thread, as I don't want
the user to manipulate other visual controls while the call is in
effect.
I don't need to display a progress bar, just some sort of a dynamic
image like this:
https://marketplace.slizone.com/SliM...es/loading.gif
or another user control that plays some dynamic content.
Any idea how to perform this?
Thanks.

Nov 12 '07 #3
On 12 Noi, 17:25, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
On Nov 12, 3:22 pm, nano2k <adrian.rot...@ikonsoft.rowrote:
I have a winforms application developed in c# v1.1.
The application has a form that calls a webservice method. The call is
performed from inside the GUI thread and may take up to a minute.

Doing that on a GUI thread is not a good idea.
Meanwhile, I want to provide to the user some sort of visual indicator
indicating that the application is not frozen.
The call to the WS should remain on the GUI thread, as I don't want
the user to manipulate other visual controls while the call is in
effect.

Then disable those controls while the operation is in progress. You
shouldn't make a long-running call on the UI thread.
I don't need to display a progress bar, just some sort of a dynamic
image like this:https://marketplace.slizone.com/SliM...es/loading.gif
or another user control that plays some dynamic content.
Any idea how to perform this?

I would seriously look at disabling all controls on the UI thread, and
then making the call elsewhere, updating the UI with a progress
indicator (of any kind, whether that's an image or not) appropriately.

I know it's a pain, but locking up the UI thread for a minute is a
really bad idea.

Jon
Hi
Thanks
Why is it such a bad idea? The only bad side I see is that the GUI
won't get painted while the call is in progress.
Actually, in 99% of the times, the call will not take more than a
second (it only authenticates the user), but, say, when the WS is
offline, the call will take long enough until the exception pops up,
so the call deserves some sort of visual signal to the user.
Isn't there a method of forcing a portion of the GUI to update from
another thread?
Tried this from another thread (using Invoke(), of course), but no
luck.

Thanks again.

Nov 12 '07 #4
On 12 Noi, 17:34, Peter Bromberg [C# MVP]
<pbromb...@yahoo.NoSpamMaam.comwrote:
As an add-on to what Jon indicated (good advice), you can put an animatedgif
into a picturebox control and turn on the Visible property when the call is
made. When results come back, you make the pic invisible. But you do not want
to make your webservice call from the UI thread.
-- Peterhttp://www.eggheadcafe.com
unBlog:http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"nano2k" wrote:
Hi
I have a winforms application developed in c# v1.1.
The application has a form that calls a webservice method. The call is
performed from inside the GUI thread and may take up to a minute.
Meanwhile, I want to provide to the user some sort of visual indicator
indicating that the application is not frozen.
The call to the WS should remain on the GUI thread, as I don't want
the user to manipulate other visual controls while the call is in
effect.
I don't need to display a progress bar, just some sort of a dynamic
image like this:
https://marketplace.slizone.com/SliM...es/loading.gif
or another user control that plays some dynamic content.
Any idea how to perform this?
Thanks.- Ascunde citatul -

- Afi are text în citat -
Peter, Jon, thanks.
I understand that calling WS methods from withing GUI thread is
undesirable.
I aggree with you both.
Peter, I already put an animated GIF on the form, using a picture box,
but the GIF gets frozen, too.
My problem is that the authentication call is only an example. The
form may call many other WS methods, so it's practically impossible
for me to put them on a separate thread.
I'm still looking for a workaround for this problem, being determined
not to make the same mistake twice.
Thanks.

Nov 12 '07 #5
On Nov 12, 3:45 pm, nano2k <adrian.rot...@ikonsoft.rowrote:
On 12 Noi, 17:34, Peter Bromberg [C# MVP]

<pbromb...@yahoo.NoSpamMaam.comwrote:
As an add-on to what Jon indicated (good advice), you can put an animated gif
into a picturebox control and turn on the Visible property when the call is
made. When results come back, you make the pic invisible. But you do not want
to make your webservice call from the UI thread.
-- Peterhttp://www.eggheadcafe.com
unBlog:http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
"nano2k" wrote:
Hi
I have a winforms application developed in c# v1.1.
The application has a form that calls a webservice method. The call is
performed from inside the GUI thread and may take up to a minute.
Meanwhile, I want to provide to the user some sort of visual indicator
indicating that the application is not frozen.
The call to the WS should remain on the GUI thread, as I don't want
the user to manipulate other visual controls while the call is in
effect.
I don't need to display a progress bar, just some sort of a dynamic
image like this:
>https://marketplace.slizone.com/SliM...es/loading.gif
or another user control that plays some dynamic content.
Any idea how to perform this?
Thanks.- Ascunde citatul -
- Afi are text în citat -

Peter, Jon, thanks.
I understand that calling WS methods from withing GUI thread is
undesirable.
I aggree with you both.
Peter, I already put an animated GIF on the form, using a picture box,
but the GIF gets frozen, too.
My problem is that the authentication call is only an example. The
form may call many other WS methods, so it's practically impossible
for me to put them on a separate thread.
I'm still looking for a workaround for this problem, being determined
not to make the same mistake twice.
Thanks.
Can't you just use a modal form on another thread ?

Nov 12 '07 #6
"nano2k" <ad***********@ikonsoft.roschrieb im Newsbeitrag
news:11**********************@k79g2000hse.googlegr oups.com...
Hi
Thanks
Why is it such a bad idea? The only bad side I see is that the GUI
won't get painted while the call is in progress.
What is bad enough. Besides, that the application appears to hang and may be
blanked out, also your indicator will appear frozen (or not at all).
Isn't there a method of forcing a portion of the GUI to update from
another thread?
Tried this from another thread (using Invoke(), of course), but no
luck.
That's, because Invoke pushes the task to the GUI-Thread, and the Invoked
method will not run, before the long call on the GUI-Thread is finished.
Besides, this also blocks the calling Invoke.

Christof

Nov 12 '07 #7
On 12 Noi, 18:06, BlueTrin <bluet...@gmail.comwrote:
On Nov 12, 3:45 pm, nano2k <adrian.rot...@ikonsoft.rowrote:


On 12 Noi, 17:34, Peter Bromberg [C# MVP]
<pbromb...@yahoo.NoSpamMaam.comwrote:
As an add-on to what Jon indicated (good advice), you can put an animated gif
into a picturebox control and turn on the Visible property when the call is
made. When results come back, you make the pic invisible. But you do not want
to make your webservice call from the UI thread.
-- Peterhttp://www.eggheadcafe.com
unBlog:http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
"nano2k" wrote:
Hi
I have a winforms application developed in c# v1.1.
The application has a form that calls a webservice method. The callis
performed from inside the GUI thread and may take up to a minute.
Meanwhile, I want to provide to the user some sort of visual indicator
indicating that the application is not frozen.
The call to the WS should remain on the GUI thread, as I don't want
the user to manipulate other visual controls while the call is in
effect.
I don't need to display a progress bar, just some sort of a dynamic
image like this:
https://marketplace.slizone.com/SliM...es/loading.gif
or another user control that plays some dynamic content.
Any idea how to perform this?
Thanks.- Ascunde citatul -
- Afi are text în citat -
Peter, Jon, thanks.
I understand that calling WS methods from withing GUI thread is
undesirable.
I aggree with you both.
Peter, I already put an animated GIF on the form, using a picture box,
but the GIF gets frozen, too.
My problem is that the authentication call is only an example. The
form may call many other WS methods, so it's practically impossible
for me to put them on a separate thread.
I'm still looking for a workaround for this problem, being determined
not to make the same mistake twice.
Thanks.

Can't you just use a modal form on another thread ?- Ascunde citatul -

- Afi are text în citat -
Thanks, I'll try that.

Nov 12 '07 #8
nano2k wrote:
Peter, Jon, thanks.
I understand that calling WS methods from withing GUI thread is
undesirable.
I aggree with you both.
Peter, I already put an animated GIF on the form, using a picture box,
but the GIF gets frozen, too.
This would be because the UI thread is blocked waiting for the WS call
to return.
My problem is that the authentication call is only an example. The
form may call many other WS methods, so it's practically impossible
for me to put them on a separate thread.
What difficulty are you having in pushing your functionality to another
thread that makes it "practically impossible" to do so?

Chris.
Nov 12 '07 #9
On 12 Noi, 19:10, Chris Shepherd <c...@nospam.chsh.cawrote:
nano2k wrote:
Peter, Jon, thanks.
I understand that calling WS methods from withing GUI thread is
undesirable.
I aggree with you both.
Peter, I already put an animated GIF on the form, using a picture box,
but the GIF gets frozen, too.

This would be because the UI thread is blocked waiting for the WS call
to return.

Yes.

My problem is that the authentication call is only an example. The
form may call many other WS methods, so it's practically impossible
for me to put them on a separate thread.

What difficulty are you having in pushing your functionality to another
thread that makes it "practically impossible" to do so?
There are few tens of web methods that are called by the client
winform application.
Moving all the calls to another thread can induce some bugs. The
application is already deployed to many customers and works online day
and night. At this moment, I couldn't assume even a minimum risc of
inducing a subtle bug. Plus, the time is limited.
So, the reasons are more non-technical than technical. Maybe in a
future release, when the time won't be such a painful thought, I could
take the luxury to redesign this part, because, believe me, I need to
redesign some other related pieces of code.
For now, I am looking for a simple solution, if one exists.
I'll get back when I find one.

Thanks all.

Nov 12 '07 #10
Don't you get frustrated when windows freeze on the screen, won't
respond to anything and display 'Not Responding'.

In programming, it is actually the 1% that involves most of the work.
>
On 12 Noi, 17:25, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
On Nov 12, 3:22 pm, nano2k <adrian.rot...@ikonsoft.rowrote:
I have a winforms application developed in c# v1.1.
The application has a form that calls a webservice method. The
call
is
performed from inside the GUI thread and may take up to a minute.
Doing that on a GUI thread is not a good idea.
Meanwhile, I want to provide to the user some sort of visual
indicator
indicating that the application is not frozen.
The call to the WS should remain on the GUI thread, as I don't
want
the user to manipulate other visual controls while the call is in
effect.
Then disable those controls while the operation is in progress. You
shouldn't make a long-running call on the UI thread.
I don't need to display a progress bar, just some sort of a
dynamic
image like
this:https://marketplace.slizone.com/SliM...es/loading.gif
or another user control that plays some dynamic content.
Any idea how to perform this?
I would seriously look at disabling all controls on the UI thread,
and
then making the call elsewhere, updating the UI with a progress
indicator (of any kind, whether that's an image or not)
appropriately.

I know it's a pain, but locking up the UI thread for a minute is a
really bad idea.

Jon

Hi
Thanks
Why is it such a bad idea? The only bad side I see is that the GUI
won't get painted while the call is in progress.
Actually, in 99% of the times, the call will not take more than a
second (it only authenticates the user), but, say, when the WS is
offline, the call will take long enough until the exception pops up,
so the call deserves some sort of visual signal to the user.
Isn't there a method of forcing a portion of the GUI to update from
another thread?
Tried this from another thread (using Invoke(), of course), but no
luck.

Thanks again.
Nov 12 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Peter Kwan | last post by:
Hi, I believe I have discovered a bug in Python 2.3. Could anyone suggest a get around? When I tested my existing Python code with the newly released Python 2.3, I get the following warning: ...
2
by: SMike | last post by:
I post this message again as I didn't get an answer back. I would appriciate any ideas. I am getting the following error when sending a https request after a long period with no activity. ...
2
by: Steve | last post by:
I have found an Activity Bar control which looks to be exactly what I need for my splash screen, but I can't seem to get it working. When I initialise the Start method, the application bar works...
1
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE: http://www.eggheadcafe.com/articles/20050108.asp My only regret is that when click the...
9
by: luke | last post by:
Hi everybody, please, can someone explain me this behaviour. I have the following piece of code: long long ll; unsigned int i = 2; ll = -1 * i; printf("%lld\n", ll);
1
by: Marko Vuksanovic | last post by:
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is...
6
by: Marko Vuksanovic | last post by:
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is...
1
by: Marko Vuksanovic | last post by:
I used the following code for implementing a file upload progress indicator, using UpdateProgress Panel, though I have a problem that FileUpload.Has File always returns false. Any suggestions what...
9
by: esakal | last post by:
Hello, I'm programming an application based on CAB infrastructure in the client side (c# .net 2005) Since my application must be sequencally, i wrote all the code in the UI thread. my...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.