|
|
The closest thread I found to my question was http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2149266[^].
I'm looking to have a thread send an update to a status indicator control. Because the control (and the form hosting it) will be on a different thread, it's necessary to perform the update via control.invoke. If window displaying the control is disposed, it would be perfectly acceptable for the call to simply do nothing.
Presently, I'm using a static Boolean field called 'tryingInvoke' which is set to True immediately before the invoke and to False as the first step of the invoked procedure. Only one thread will be attempting to perform the invocation, so that shouldn't introduce any thread-safety issues. The invoke() call is surrounded by a try block which includes
Catch ex As ObjectDisposedException When tryingInvoke
That seems to catch the ObjectDisposedException in case the object gets disposed between the invoke attempt and the actual invocation, but it seems rather clunky and it doesn't avoid a first-chance exception. Delaying the form close while making repeated calls to Application.DoEvents (suggested in the other thread) might be workable, but I would think that having a control calling DoEvents would be a Bad Thing.
Are there any better approaches?
|
|
|
|
|
supercat9 wrote: but it seems rather clunky
Sure but it's the second clunk, which is required due the first clunk. The first clunk was a design that allows an object to be disposed while another object has a reference to it. In a garbage collected environment that's not supposed to happen. It probably takes the violation of one or more principles/best-practices to accomplish that loud of a clunk.
led mike
|
|
|
|
|
How would you suggest that a status indicator control should be implemented when the thread whose status is being monitored is separate from the thread that owns the form where the control appears? I have a control which is perfectly happy with having its underlying data changed asynchronously (that's all thread-safe), but I need some way to request that the control be updated when that occurs. I don't see any reason the .Net framework couldn't have provided an asynchronous .Refresh method (which would return immediately, but cause the control to be refreshed when convenient), but I'm not aware of any such feature.
|
|
|
|
|
supercat9 wrote: How would you suggest that a status indicator control should be implemented
Ever hear of the Observer Pattern[^]?
led mike
|
|
|
|
|
I'm not quite clear how the Observer Pattern would solve the problem. The Subject is running on a different thread from the control that's acting as Observer. Between the time the Subject decides to "Invoke" the control and the time the Invoke actually happens, the Observer could notify the Subject that it's going away, but there would be no way for the Subject to act upon that information before the Invoke occurs.
(IDEA): Perhaps a dummy object could be created which is bound to the same thread, and the invocation passed through that? Since the code invoked on that control would be running on the only thread that could dispose the control, it could guarantee that the control couldn't get asynchronously disposed. Not sure how to create such an object without it being bound to the window handle that might asynchronously disappear, though.
|
|
|
|
|
|
Nice post and nice links. Thanks
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
Hmm... I'm probably barking up the wrong tree, but I'm not quite clear what the 'right' tree would be. What should happen, effectively, is that a message should get posted that the control will receive when convenient which asks it to refresh. To minimize excessive queueing of events, the control could have a variable which indicates whether an event has yet been queued and not yet received. The code that's considering sending the message should interlocked.Exchange this value to 1; if it was zero, send the refresh request. The code that handles the refresh should clear the value before performing the refresh.
Should some method other than .invoke be used to send the refresh request to the control? If so, what?
|
|
|
|
|
I am trying to use Microsoft Word Object Library v11 to convert word doc files into text format , it works fine on my local mechine but when I uploded it to server this error occurs "That assembly does not allow partially trusted callers"
Does any one know how to make the assamly fully trusted or is there any other way for convertion ?
x
|
|
|
|
|
Don't cross post (more than one forum) and certainly don't repost the same question, that's worse than spam.
I see you are a new member here. Welcome, but take the time to read some of the posting guidelines before people feel you are abusing the site resulting in you not getting any assistance.
led mike
|
|
|
|
|
I am trying to use Microsoft Word Object Library v11 to convert word doc files into text format , it works fine on my local mechine but when I uploded it to server this error occurs "That assembly does not allow partially trusted callers"
Does any one know how to make the assamly fully trusted or is there any other way for convertion ?
x
|
|
|
|
|
Hi,
Can anyone please tell me how to determine if ".Net Framework 2.0 SP1" is Installed, currently I am reading "Install" "dword entry" from registry path "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v2.0.50727" to find if .Net Framework 2.0 is installed or not, does anyone know how to determine about "Framework 2.0 SP1".
Thanks,
Mushq
|
|
|
|
|
Take a look at this article[^]. Also, if you're trying to do this as part of an installer, you shouldn't be using managed code.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Thanks.
Regards,
Mushq
|
|
|
|
|
|
|
Hi
I have a SecuGen fingerprint scanner. I want to integrate this scanner with a .NET application without using a SDK. Is it possible to acquire finger print from the scanner using .NET framework??? Thank u. Plz help..
|
|
|
|
|
If I am correct, their is no way to work with a fingerprint scanner from .NET. Their is a slight chance that you can do this through DirectX, but even still I would not count on it. You would have to use an SDK or third party utility to communicate with the fingerprint reader.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
It depends on how your scanner is connected to your computer. You may also have to do some low level homework.
What's wrong with using the SDK? At least you can call the function from your .Net app using p/Invoke.
Regards
|
|
|
|
|
i need to connect the finger print scanner in my application , but, I didn't have idea about that.because , i searched in lot. but, i cant able to get any basic structure for that codes. so, plzz any one can help me to implement scanner integration to My application.
I am using c# in VS 2005.
I am expecting your solutions for that problem.
Thank you.
|
|
|
|
|
Hello
is their somebody how knows if their is a component how can make a printform (with Oracle or mssql)
and then print it.
Thanks a lot
kosmas
|
|
|
|
|
If your data are displayed in a windows form you can use the MCL Form Print Control[^] to turn that into a nice structured printed document.
Otherwise you could look at report components : SQL Server Reporting Services, Crystal etc.
|
|
|
|
|
Hi i just stuck up with dotnet creating module in dotnetnuke 4.8.4, im beginer to dotnetnuke.
can any one help me? how to create a simple application in nuke 4.8.4?
Jayanthirajan P.
iam a software engineer working for varisis technologies bangalore
|
|
|
|
|
Have you looked through all the dotnetnuke doucmentation materials? Sure there has to be something that can shed light.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|