Error detection

Apr 20, 2012 at 12:17 PM

So far I've built a nice GUI to edit some options for my application. Everything is presented in a simple PropertyControl where I set SelectedObject to the object that should be edited (I have three of these). I have also implemented error checking (using reflections) for the issues not detected by PropertyTools. This is done when the user tries to save his changes. Now, my problem is that I don't know how to make my Apply_button method aware of any issues that may be detected by PropertyTools (e.g. usmall overflow for a port number), without having to manually check them.

Apr 20, 2012 at 12:31 PM

I initially imagined I could do something like myPropertyControl.GetIssues(), and just verify that there were no errors, or otherwise present the user with the errors, or just the fact that there is an error, along with my other error messages.

Apr 20, 2012 at 7:29 PM

Did you implement IDataErrorInfo on your model? 


If you edit in a dialog you should also implement IEditableObject


Apr 22, 2012 at 9:14 PM

Well, so far the default checks of PropertyTools (i.e. that my numbers are within ushort), but I might consider those in the future. Right now I am just looking for a quick thing to stop my apply method from saving if there are errors in the default checks.