I am writing a add-in for outlook. I want to ask password before inactivating the add-in. if password is not correct, Add-in shouldn't be inactive. While inactiving add-in it is firing "ThisAddIn_Shutdown" event but I can't block inactiving add-in.
This is my code:
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
var frm = new FrmCheck();
var result = frm.ShowDialog();
if (frm.Statu==WinStatu.Close && result == DialogResult.OK)
{
//password is correct. Close Add-in
}
else
{
//TODO: cancel closing this add-in
MessageBox.Show("You can't close this add-in, please enter valid password.");
}
}
Thanks.