ThisAddin class
The ThisAddin_Startup()
event is a good place to test for the correct Visio version and edition, along with checking that the Visio application events are indeed enabled, otherwise this add-in will not work properly anyway.
private void ThisAddIn_Startup(object sender, System.EventArgs e) { try { veApplication.VisioApplication = this.Application; /* check prereq's */ // check for Visio >= 2010 and Edition >= PRO if (!this.IsVisio14PremiumInstalled) { MessageBox.Show( "This add-in requires the Premium edition of Visio 2010", "Visio Premium edition required", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } // events must be enabled if (!Convert.ToBoolean(Globals.ThisAddIn.Application. EventsEnabled)) // -1 is TRUE, 0 is FALSE, typically anything other than 0 is TRUE { if (MessageBox.Show( "Event are currently disabled, this add-in requires events to be enabled. Would you like to enable events now?", "Rules Tools", MessageBoxButton.OKCancel, MessageBoxImage...