473,802 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5295
On Nov 12, 3:22 pm, nano2k <adrian.rot...@ ikonsoft.rowrot e:
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.co mwrote:
On Nov 12, 3:22 pm, nano2k <adrian.rot...@ ikonsoft.rowrot e:
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...@yaho o.NoSpamMaam.co mwrote:
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.rowrot e:
On 12 Noi, 17:34, Peter Bromberg [C# MVP]

<pbromb...@yaho o.NoSpamMaam.co mwrote:
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.roschr ieb im Newsbeitrag
news:11******** **************@ k79g2000hse.goo glegroups.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.rowrot e:


On 12 Noi, 17:34, Peter Bromberg [C# MVP]
<pbromb...@yaho o.NoSpamMaam.co mwrote:
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 "practicall y impossible" to do so?

Chris.
Nov 12 '07 #9
On 12 Noi, 19:10, Chris Shepherd <c...@nospam.ch sh.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 "practicall y 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

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

Similar topics

2
4979
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: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up It is because I used some constants such as 0x80ff3366, so I change it to 0x80ff3366L, hoping to get rid of the warning.
2
1629
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. Cannot access a disposed object named "System.Net.TlsStream". After that everything sems to be fine untill the next long idle period. The code is below.
2
3031
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 great until I do any other processing, which is when it freezes! There is no documentation with the control which I downloaded from: http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=7B0E2EAB-42C4-47AA-9292-731052946BD5 I...
1
6028
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 browser back button, it loads the progress bar again. Any solution to this?
9
3955
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
2225
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 it possible to implement it using some other control, for example a floating window? A link to example would also be useful. Thanks, Marko Vuksanovic.
6
10106
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 it possible to implement it using some other control, for example a floating window?
1
2143
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 might be wrong? FileUpload2.aspx <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FileUpload2.aspx.cs" Inherits="FileUpload2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
9
3273
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 problem occurs when i try to show a progress bar. The screen freezes. I know i'm not the first one to ask about it. but i'm looking
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10305
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10063
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.