Home

PanelHelper

PanelHelper

Sharing this code in case it's helpful to others. Had a situation where the browser would occasionally (but consistently) throw an exception in my DumpPanel. The help text with the exception suggested hooking into CoreWebView2.ProcessFailed, but I didn't want to divert from was I was doing at the time.

That said, I had this other code for writing to a new panel which I was using prior to DumpPanel. I spent a little time cleaning it up for sharing. PanelHelper has limitations relative to the other code; namely it only writes text. And, unfortunately, it can't be copied either. That said, it's been a reliable workhorse over the past few years. Maybe someday I'll spend some time to take an arbitrary object and create a WPF control to mimic Dump, but I haven't had a need for that level of functionality.

My specific use case for this code was writing output from potentially long-running processes (converting video from one format to another). To that end, I only need to write the standard/error text responses. One plus for this scenario is I can filter out progress statements and write them to a control within a pinned dump container.

In my specific case, I change the background color of the new panel to #282828. This value was taken from Preferences > General tab. I didn't see a way to capture this value and use it, but change it to whatever background you want (look for backgroundColor).

Feedback is welcome. I'm sure there are plenty of ways it can improved.

Sign In or Register to comment.