I have a dialog box popup in a VSTO addin for outlook 2013. I test for DialogResult.Yes and No, to which I have set the two buttons' results. They work fine, but I want yet another behavior when the user cancels out of the box. When they press cancel the code just continues. Is there something I can call to stop the addin from executing if they cancel the dialog box? How can I test for the cancel button? I tried res == DialogResult.Cancel but it can't cast res to bool and it's type DialogResult because I also test for Yes and No.
How can I tell if they press the cancel button, and how can I exit the addin. In python the command would be sys.exit() What is the C# equivalent?