Hello fellow developers!!
I have been developing in Process Simulate for 6 years. Up until recently I have utilized winforms in Commands and Viewers. I am rewriting my DCS Modeling Designer viewer utilizing a WPF UI with MVVM pattern. I ran into an issue with utilizing the TXMessageBox.Show(). It is called in a catch block, which is in a service class for creating modeling objects to catch any uncaught errors that may relate to missing parameters that I cannot control. The Service Class Method is called by a ViewModel method that is connected to a property changed event, namely a value changed in the numeric up down control I pulled down from Nuget.
I eliminated it being any UI related issues in the binding such as maybe it being a value changed in the Nuget control .dll getting stuck by eliminating the Message Box call and running it, so it is the TxMessageBox.Show causing the problem. Has anyone else had issues like this?
Solved! Go to Solution.
Can you send a small example so we can analyze the problem?
We are using the TxMessageBox with WPF dialogs and we haven't experienced that problem.
Have you insured you are on the same thread as well?
Im not having any issues with TxMessageBox but at times have seen some weird behavior with other controls using MVVM, I think it was mostly the TxNumericUpDownEditControl, but thats because its not NativeWPF but a wrapper that is basically using a WinForms control within it, so i had to rewrite the control to get the functionality i wanted from it.
Make sure that you turn on debugging at least when your stepping through to a higher level
I may be wrong but Tools/Options/ and then type debug. I usually in VS the options are set to warning, set them all to information and it will spit out alot more info for you.
I would have to send the whole project for you to replicate the propble. Like the post below I am suspecting it is a thread issue with the numeric control I implemented.
The error is in:
"Dispatcher processing has been suspended, but messages are still being processed."
System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
If I have time to fully investigate it I will post any resolution here. I just switched back to the basic MessageBox to resolve it.
I am guessing this is Mr C. B. ? I am certain it is a threading issue with the numeric control. Thanks for the tip with the debugger. I did not realize VS was hiding so much useful information about WPF components and such while debgging.
It is not a hot issue since I have a work around. But I have determined it is a problem with the numeric control. It has seperate handlers for when a value is typed in and when the up down buttons are used. I am going to replace it with something tailored by me to work correctly when I have the time to tinker with writng my own control for it.