StatusBusy class

StatusBusy class

Old forum URL: forums.lhotka.net/forums/t/1146.aspx


jjm_ewu posted on Wednesday, September 06, 2006

Now this might be me but the StatusBusy class isn't work like it should be. When testing out the Project Demo from the main window and you are logged out this is the code that runs....

private void OK_Click(object sender, EventArgs e)

{   

using (StatusBusy busy = new StatusBusy("Verifying credentials..."))

{

ProjectTracker.Library.Security.PTPrincipal.Login(this.UsernameTextBox.Text, this.PasswordTextBox.Text);

}

this.Close();

}

So here we are running through the code and first thing that is suppose to happen is the status is suppose to get set to "Verifying credentials.....". Hmm this doesn't happen on my box. Actually no matter what the status is set by it never gets set. Now my thoughts are one of two things are happening...

1. This is only happening to me and my computer

2. The message for the refresh isn't happening. Actually, a UI threading, message pump issue is what I am thinking.

Anyways any ideas would be great to hear.

 

James

karl replied on Thursday, September 07, 2006

I had the same problem, fixed it with a My.Application.DoEvents.

mMain.pnlStatus.Text = value

My.Application.DoEvents()

figuerres replied on Thursday, September 07, 2006

it may be better to just get the control to update .... app.dovents is kinda "overkill" to get one control to update.

ajj3085 replied on Thursday, September 07, 2006

Its a UI threading thing; the Login is blocking the UI thread.  You can run the code in the background, but it might make it hard to use that StatusBusy class.

DansDreams replied on Tuesday, December 05, 2006

Since windows forms threading (or simplicity thereof) is going to prevent this thing from really doing much useful, has anybody found a way to use it that works.  I really like the concept.

Architecture Astronaut replied on Monday, January 29, 2007

I just call Refresh on my StatusStrip in the StatusBusy constructor.  That seems to do the trick.

Copyright (c) Marimer LLC