StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Few questions about threads and waitwindowExpand / Collapse
Author
Message
Posted 06/29/2007 9:19:33 AM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: Forum Members
Last Login: 04/11/2008 10:01:54 AM
Posts: 105, Visits: 650
I need to invoke the vb threading gods of the forum.  I'm very new to delegates and cross form method calls etc.

I have a main form with a class level WaitWindow that methods on the form can show, hide, update whatever.  This form makes several calls to a class that performs a lot of data manipulation.  Some of these take a long time, so I decided updating the WaitWindow would be nice to let the user know something is going on.

My declaration of the WaitWindow on the form.

Public WithEvents loWaitWindow As New MicroFour.StrataFrame.Messaging.WaitWindow

Here is my method to Update that WaitWindow

Public Sub UpdateWaitWindow(ByVal lcMessage As String)

'-- Update the Wait Window Message

Me.loWaitwindow.Message = lcMessage

End Sub

And on my class that does the data manipulation, I added this delegate

Public Delegate Sub UpdateWaitWindow(ByVal lcMessage As String)

And I added a Reference to the main Form to call UpdateWaitWindow on

Public Shared loForm As frmProjectMain = CType(Application.OpenForms("frmProjectMain"), frmProjectMain)

Now should I be able to call this UpdateWaitWindow by simply ?

loForm.Invoke(New UpdateWaitWindow(AddressOf loForm.UpdateWaitWindow), "new message")

Post #9847
Posted 06/29/2007 11:10:11 AM
StrataFrame VIP

StrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIPStrataFrame VIP

Group: StrataFrame Users
Last Login: Today @ 11:22:35 AM
Posts: 1,356, Visits: 3,615
I need to invoke the vb threading gods of the forum.


Well, that leaves me out, even though I do own a sewing machine and I'm not afraid to use it!

Sorry for the unhelpful reply...it's been a hard week, it's friday, I've been up way too long and it's summer time, and silliness just bubble to the fore.

I'll be watching the thread (er...no pun intended) to learn more about threads though!
Post #9853
Posted 07/02/2007 8:46:51 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/09/2008 3:36:08 PM
Posts: 2,686, Visits: 1,891
Yes, that's how you would do it.  Now, when you're calling the Invoke of the ISynchronizeInvoke interface (on any Control object, like a form), you have to make sure that the control's thread is not busy.  Meaning, if you try to Invoke() from the main thread back to the main thread, you'll enter deadlock... the CLR waits until the main thread is not busy before calling the invoked method.


www.bungie.net
Post #9876
Posted 07/02/2007 2:50:45 PM
StrataFrame Novice

StrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame NoviceStrataFrame Novice

Group: Forum Members
Last Login: 04/11/2008 10:01:54 AM
Posts: 105, Visits: 650
Great.  Thanks Ben.

Robin Giltner

Post #9914
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 12:48pm

Powered by InstantForum.NET v4.1.4 © 2009
Execution: 0.125. 12 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.