Ok so I have generated a very simple Ribbon to be added to each new Compose window that a user opens. The ribbon works fine the first time. It has 2 checkboxes on it, lets say the user selects the first checkbox and sends their message.
If I debug the code when the user sends their first message. In the ItemSend
event I access Globals.Ribbons.MyRibbon.MyCheckbox1.Checked
it will show that checkbox is checked. That window closes and the user opens a new email.
Lets say that in the second email the user clicks the second checkbox Globals.Ribbons.MyRibbon.MyCheckbox2.Checked
. If I debug the same ItemSend
event and look at that field it shows it as false and the the first checkbox is currently checked.
It is almost as if the Globals.Ribbons.MyRibbon
control instances aren't getting updated properly or if I am misunderstanding its not getting disposed of properly.
Edit 1
As an update I used the Ribbon (Visual Designer) to create my ribbon. Should I have used the Ribbon (XML)?
Edit 2
Not sure how adding this to my question, when it is already in the original question above makes any difference but here is my "code" that I used in the application.
private void ThisAddIn_Startup(object sender, System.EventArgs e) {
this.Application.ItemSend += new Outlook.ApplicationEvents_11_ItemSendEventHandler(Application_ItemSend);
}
void Application_ItemSend(object Item, ref bool Cancel) {
if (Globals.Ribbons.MyRibbon.MyCheckbox1.Checked) {
} else {
}
}