In my add-in for Outlook, I have the following lines.
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
MessageBox.Show("Hazaa!");
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
MessageBox.Show("Shazoo...");
}
While Outlook greets me with a cool "Hazaa!" upon its start, it refuses to go "Sahzoo..." on me when I', closing it. Both methods are registered in the same way using the default, auto-generated code, so I don't suspect any errors there. The other explanation I can think of is that the shutting down process is executed when the application already has left the GUI and the shazooing is hidden.
Is it so? If not, how can I make Outlook shazoo me? If so, how can I notify a user visually of such a shazoo?
EDIT:
Apparently, since O10, the shut down is no longer to be called, so the auto-generated code below is indeed wrong (or at least not perfect). Courtesy of @Christian.K.
#region VSTO generated code
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…