|
Hi,
Here is a situation.
I need to perform long operation in UI thread. I must do it in UI thread, cause algorithm uses 3rdparty resources managed by UI thread. And these resources are not thread safe. So, I do it in UI thread. Because operation is very long I would like to not block the application. What I want is:
1) Interrupt algorithm execution. Store some message in message queue that algorithm must be resolved.
2) Application process all pending events in the queue (key eents, mouse events, draw events etc).
3) I get the the control again in some my handler. (All in the same thread)
Similar to what I would do with PostMessage. Like a System::Windows::Forms::Timer with 0 interval (which is not allowed).
How can I do that?
And here is another detail: I'm doing all this NOT from UI control class. In fact I do it in static member function. But I'm in main(UI) thread.
Thanks.
///////////////////////////////////////////////////////////////////////////////
Found a resolution.
System::Windows::Threading::Dispatcher class does exactly what I need. And it doesnt require a UI control (like COntrol::BeginInvoke).
Works perfect.
Theme closed.
modified on Wednesday, February 23, 2011 8:47 AM
|
|
|
|
|
progDes wrote: I must do it in UI thread, cause algorithm uses 3rdparty resources managed by UI thread. And these resources are not thread safe. So, I do it in UI thread
There may be a way, but apparently there's no will.
More information would be helpful.
|
|
|
|
|
Could you open a new non-visible window and do it there?
"You get that on the big jobs."
|
|
|
|
|
If this window will be in the same thread as main UI thread (which is requirement) - it will block application anyway.
|
|
|
|
|
Ok, I didn't realise it had to be in the main UI thread. If you can host the 3rd party resources in a separate UI thread, you may find an answer here
"You get that on the big jobs."
|
|
|
|
|
No I cant.
Found a resolution.
System::Windows::Threading::Dispatcher class does exactly what I need. And it doesnt require a UI control (like COntrol::BeginInvoke).
Woeks perfect.
|
|
|
|
|
Where can I find in-depth guidance for building complex WinForms Setup projects? To be specific, I need to build a single setup package for a DevExpress eXpressApp WinForms application, including a setup for SQL Server 2008 Express, and the creation of a database from scripts. The DevExpress bit is no problem - the Setup Project Wizard neatly includes all dependencies, but guidance on SQL, running other programs from Setup, etc. seems scant. Nearly all articles I find overlook anything beyond the same package the wizard creates.
It looks like I have to go collecting little separate bits all over the place to get the whole task done. I would like to find a single, advanced and comprehensive resource that covers all aspects of WinForms deployment. Maybe somebody can recommend a book?
I used to be quite the master at this, even manually editing tables in the .msi files, writing C++ booby-trappers etc. but that was over 10 years ago, and my knowledge seems to have atrophied completely.
|
|
|
|
|
I'm afraid I can't answer your question, but when you finger out what you need to do and how to do it, that's a great opportunity for an article.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I was just thinking that, seconds before I read your reply. I've got so much article waiting to be written on DevEx, but that's too proprietary and better suited to my blog. This would make a good article.
I've opened my eyes a bit, and I easily achieve my requirement to install the database on the SQL Express server by not doing so, and using a User Instance DB instead. Now my setup only has to get Express installed and my worries should be over.
|
|
|
|
|
It seems what you want is to create a Custom Action, which are many resources that cover this topic. You may also need to use Orca[^] or some of these[^] tools
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks. I've actually since found that I can stipulate SQL Express as a prerequisite on the setup project's Property Pages, and make my DB a user instance DB, with no need to attach or restore, but My question is open for all packages,
Orca is the name I was trying to remember that I at one time used.
|
|
|
|
|
We've just started seeing a System.AccessViolation exception ocurring in our ASP.NET website, which we're struggling to get our heads around - anyone have any ideas?
The situation is that we have a page which makes a call to the database through a C# class library. This call is "succeeding" in that I'm seeing it being issued under SqlProfiler, and running the query returns the results I'd expect to see. The next database call appears not to be happening.
The next call takes data from the return of the first call, so we thought it could potentially be a ADO.NET issue, but looking at the call stack, it appears that it's occurring in a function that we aren't actually calling.
The call stack indicates that the exception is ocurring in our Encrypt function - this function uses DESCryptoServiceProvider to encrypt data. It's used in many places in our app, but we're only seeing the exception in one place. Additionally, as mentioned, the Encrypt function is not being called according to the code, but it is according to the stack trace...
To add a little more confusion, we're only seeing this on one of our servers (which happens to be remotely hosted) - all in house servers (both dev and standard boxes) are just fine.
Anyone?
C# has already designed away most of the tedium of C++.
|
|
|
|
|
that sounds to me like your one server is running an older, maybe even an inconsistent, set of files. How about you remove everything and reinstall the site on that server?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks for the reply Luc.
Starting to think that may be the solution, but it does seem to be a rather large sledgehammer to crack a pretty small nut lol! Particularly when considering the fact that all of the other sites on the same server use the same source code (albeit in differently versioned dlls) and are all just hunky dory
Having already unregistered and reregistered asp.net, a reinstall of the site would probably be the next logical step, with a reinstall of the framework if that doesn't fix it.
Many thanks
C# has already designed away most of the tedium of C++.
|
|
|
|
|
You're welcome.
You aren't trying to mix .NET versions on a single IIS, are you? as that is not supposed to work AFAIK.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
OK - now that's something we DIDN'T know....though we do have that situation on many of our other servers.....wondering now if you're actually correct and it's not SUPPOSED to work, we've just been lucky in that it has, but now we're seeing the problem.
Again, many thanks chap.
C# has already designed away most of the tedium of C++.
|
|
|
|
|
It can be that you have encoded your connection string and while the user account has sufficient permissions to decode it on your own servers, it doesn't has so on the production servers.
|
|
|
|
|
Hi,
We aquired another company some time ago. That company used to be a software vendor which used the Delphi7 language to make their applications. These applications will be retired as they were way past their end-of-life. This brings me to this question. These developers whose world is Delphi, they will be writing software for us using the .Net framework (3.5/4.0) and C#. We have a number of dead-tree books here, but I was wondering if there is a good place online to learn C#. They already have the concepts of OOP.
What online course can you recommend for them? It needs to be available internationally, since the developers are in Europe and some in the Asia.
Thanks for advice!
The consumer isn't a moron; she is your wife.
|
|
|
|
|
.NET Book Zero[^] by Charles Petzold, is a great starting point for experienced programmers to learn C# and .NET basics.
I must get a clever new signature for 2011.
|
|
|
|
|
|
IMO any "dead-tree book" as you call 'em will be better than the typical on-line stuff.
I have studied many over the years, I can't tell you which one is best, and it is pretty subjective anyway.
Wrox has a nice one, Microsoft's Step by Step series is good too.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I needed a quick term for physical book (offline book?). The books I have here are 900+ pages, so I'm not sure whether to call 'm reference books or studymaterial.
Thanx for the suggestion, I'll check them out later today (when the mandatory meetings have been dealt with )
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
I like the dead tree term. Most good books will step them through the learning curve plus they can then be used as reference for a while, until the team are up to speed.
You might do well to let them pick their own book however as everyone has there own learning style. A book you like, may not suit the other members of the team.
"You get that on the big jobs."
|
|
|
|
|
I find MSDN to be an excellent resource.
It has all the code snippets and everything!
-
Bits and Bytes Rules!
10(jk)
|
|
|
|
|
Yeah, some of them even compile
|
|
|
|