0

I wrote a validation function that is run by a BackgroundWorker in a WPF application. It formerly ran on the UI thread, but it's a little intense and was freezing the UI. As a result, I had to wrap lots of lines om the validation function with dispatcher calls, so many that I'm worried about a performance hit. I count 20 dispatcher calls in 53 SLOC. For the most part they're pretty simple calls--usually just lambdas that set a property.

Is this going to bite me later?

Thanks!

Jay
  • 510
  • 6
  • 17
  • 1
    There's no way to know without actually measuring the performance. – Robert Harvey Aug 24 '12 at 19:54
  • Why do you need so many dispatcher calls in a validation function? Is it validating like 20 different controls? – CodingGorilla Aug 24 '12 at 19:55
  • I just inherited this code, so I can't tell you why, but a lot of attributes are stored in what looks like XML, so their get/set comes from a PropertyBag (I think). For some reason, this seems to need to run on the UI thread. I update these attributes with the status of the validation. It might need refactoring, but I'm just trying to get proof of concept right now. – Jay Aug 24 '12 at 20:15

0 Answers0