/// <summary> /// Closes the project. /// </summary> public void Close() { if (Closing != null) { Closing(this, EventArgs.Empty); } if (IsOpen) { if (repository.IsOpen) { // Get styleSet before closing the repository IStyleSet styleSet = ((IStyleSetProvider)this).StyleSet; // Delete GDI+ objects created from styles ToolCache.RemoveStyleSetTools(styleSet); // Close Repository repository.Close(); } // Clean up project data settings.Clear(); model = null; history.Clear(); settings = new ProjectSettings(); // TODO 2: Unload dynamic libraries and remove the corresponding shape and model types. //RemoveAllLibraries(); } if (Closed != null) { Closed(this, EventArgs.Empty); } }