void IExtensionApplication.Initialize() { // Add one time initialization here // One common scenario is to setup a callback function here that // unmanaged code can call. // To do this: // 1. Export a function from unmanaged code that takes a function // pointer and stores the passed in value in a global variable. // 2. Call this exported function in this function passing delegate. // 3. When unmanaged code needs the services of this managed module // you simply call acrxLoadApp() and by the time acrxLoadApp // returns global function pointer is initialized to point to // the C# delegate. // For more info see: // http://msdn2.microsoft.com/en-US/library/5zwkzwf4(VS.80).aspx // http://msdn2.microsoft.com/en-us/library/44ey4b32(VS.80).aspx // http://msdn2.microsoft.com/en-US/library/7esfatk4.aspx // as well as some of the existing AutoCAD managed apps. // Initialize your plug-in application here InitializeComponent(); try { // 加载插件时自动执行某些命令,而不通过手动输出命令来执行 var ime = new AutoSwitchIME(); } catch (Exception ex) { Debug.Print("AddinManager 插件加载时出错: \n\r" + ex.Message + "\n\r" + ex.StackTrace); } // Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage($"{AddinOptions.TabId}程序加载成功\n"); }
/// <summary> /// 加载 AddinManager 插件时自动执行 /// </summary> void IExtensionApplication.Initialize() { try { var ime = new AutoSwitchIME(); } catch (Exception ex) { Debug.Print("AddinManager 插件加载时出错: \n\r" + ex.Message + "\n\r" + ex.StackTrace); } }