/// <summary> /// Create our Taskpane and inject our host UI /// </summary> private void LoadUI() { // Find location to our taskpane icon var imagePath = Path.Combine(Path.GetDirectoryName(typeof(TaskpaneIntegration).Assembly.CodeBase).Replace(@"file:\", string.Empty), "logo-small.png"); // Create our Taskpane mTaskpaneView = mSolidWorksApplication.CreateTaskpaneView2(imagePath, "Woo! My first SwAddin"); // Load our UI into the taskpane mTaskpaneHost = (TaskpaneHostUI)mTaskpaneView.AddControl(TaskpaneIntegration.SWTASKPANE_PROGID, string.Empty); }
/// <summary> /// Cleanup the taskpane when we disconnect/unload /// </summary> private void UnloadUI() { mTaskpaneHost = null; // Remove taskpane view mTaskpaneView.DeleteView(); // Release COM reference and cleanup memory Marshal.ReleaseComObject(mTaskpaneView); mTaskpaneView = null; }