Enhancing the 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 >= 2013 and Edition = PRO
if (!this.IsVisio15ProfessionalInstalled)
{
MessageBox.Show(
"This add-in requires the Professional edition of Visio",
"Visio Professional edition required", MessageBoxButton.OK,
MessageBoxImage.Exclamation
);
return;
}
// events must be enabled
// -1 is TRUE, 0 is FALSE, typically anything other than 0 is TRUE
if (!Convert.ToBoolean(Globals.ThisAddIn.Application...