Question

I'm using the WindowsAPICodePack's TaskDialog implementation, but it bugs me that I have to listen to click handlers on its buttons for even the more basic implementations. I'd like to convert/wrap it so that like the old MessageBox it blocks until closed and then returns a value based on what was done. Is there anything I can read for the basics on how to do this? I just have no idea where to even start, as I am admittedly not that familiar with the Win32 underpinnings.

Was it helpful?

Solution

In case it helps someone, after some reading I figured out that the Show call is blocking already. In order to return a value, I implemented a base class ExtendedTaskDialog<T> which contains a TaskDialog and contains a helper Show(Window) method in order to assign the TaskDialog's parent, and an abstract public T Show(Window) method. Actual dialogs derive from this, and derive their own enum to supply as the base type, like MyDialog : ExtendedTaskDialog<MyDialogResult>. Then, internally, MyDialog's buttons' Click handlers set the result before calling the Close method of the the internal TaskDialog.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top