WPF Version
llewelynrex opened this issue · 7 comments
Have you ever considered a WPF version? I've just forked the solution to check out a few things. I've had some issues with the scaling and positioning of the icons and text on the buttons on my laptop at work and I suspect it might be due to windows forms. Perhaps I could hack and slash on my side and see what I come up with. Would you want to incorporate something like that into your solution?
Hey @llewelynrex I had started a WPF version and tried to commonize the code but never had enough time or reason to finish it, so I took the code out, because the way I had done it was effecting the non-WPF version.
But yes, I would love to have a WPF version integrated into ExceptionReport.
BTW The code is designed with something like the MVP (Model/View/Presenter) pattern - so hopefully you can fairly easily separate the Xaml/View from the code needed to gather data etc
I remember deciding that a new assembly for WPF would be the way to go, given the different but similar libraries used (eg I remember something like WinForm.Clipboard and WpfClipboard)
I can start working on this if it still needed.
Thanks @cmkaus - I think the best thing about going XAML would be the improved support for high DPI graphics settings - which cause a lot of trouble in WinForms and seem to be much easier to solve by just using WPF
I've pushed the WPF version of ExceptionReporter into the master branch - see screenshot below.
It uses the same code base and incorporates the newish "Shared Project" (circa 2015?) in Visual Studio.
I've added a WPF demo project so you can see how it's used.
I made it a UserControl
- which seemed to be the best/easiest way to do it in WPF - happy for any WPF wisdom.
WPF version is not as featured, in terms of UI customisation, but I don't think it needs to be - I've kept it simpler.
The demo shows creating your own Window in WPF and setting the Content property to the ExceptionReporter UserControl.
From there you have the same copy/email
buttons and the show detail
, just toggles between showing the main exception message and the full report in a textbox.
I need to add a "Save to file" button and incorporate resource/translations and a different/WPF method of taking screenshots but apart from that, I think it's ExceptionReporter KISS style.
I'll also need to incoporate a separate NuGet package for it.
The separation of code that enabled this work was pretty good already - but there was some work in there.
Some logic that should have been common, I had to pull out of the WinForms presenter and the libraries to do screenshots are not compatible so I just left screenshots out of the WPF version for now.
It wouldn't be that hard to incorporate screenshots but in my real life use of ExceptionReporter, I never use that feature so I wasn't that motiviated to do it yet.
I made 2 small breaking changes, to WinForms version, that is unlikely to affect anyone (to keep it common)
- IViewMaker.ShowError method dropped the 2nd argument
description
- this is now taken from localized resources - ExceptionReportInfo property
BackgroundColor
is now a hex color code string, not aSystem.Drawing.Color
object