This project has moved. For the latest updates, please go here.

BusyIndicator: Suspend UI-interaction while background processes are running

Dec 11, 2012 at 6:44 AM
Edited Dec 11, 2012 at 7:17 AM

Hi good people 

In my logging-mechanism i have an Event that is fired whenever a message is logged. I listen to this event to provide messages to the UI - splashscreen, custom dialogs etc. As soon as the main window is loaded it grabs the messages and displays it in the status bar. 

Now i still want to use this mechanism to log debug and verbose information while the BackgroundWorker processes are running, but simply suspend the event from firing (or the UI from listening), so the "no interaction with the ui" rule is not broken. I tried doing this by setting a "BGProcessRunning" flag

  • on application-level 
  • in my logging class
  • in a module
  • in a My.Settings setting

neither of this works. The flag is completely ignored from within the logging class while the Backgroundprocess is running ie. still "False" - probably due to threading issues which i don't (and in the face of current deadlines also don't want to ;)) understand. 

Is there an easy way to achieve this? I have not gone for a lockfile as this feel very hacky - but maybe the whole idea is hacky, please enlighten me. Encapsulating the eventraise in a try-catch block also works but.... meh... is it an "Exception" when i exactly know when and why it is happening?

For now i'm simply not raising the event for anything but user-level messages but this is unsatifactory, as i was also listening to it on application-level to send all messages to the Debug-Window during development time and that was very helpful. 

Thanks a bunch.

 

PS. I LOVE the toolkit! <3

Dec 11, 2012 at 7:45 AM

Okay consider this solved and closed.

After researching a bit i had an epiphany about how bad this idea is and how clean and useful it is to instead make the background-processes self-aware and only let them provide verbose, debugging or error information which will never show up in the UI mixed in with user-level information.

Thank you interwebs :)