int IVsPersistDocData.Close() { if (EditorProcess != null) { DetachEditorWindow(); var editorProcess = EditorProcess; EditorProcess = null; var editorWindow = EditorWindow; EditorWindow = IntPtr.Zero; // Close editor window _ = System.Threading.Tasks.Task.Run(() => { NativeAPI.SendMessage(editorWindow, NativeAPI.WM_CLOSE, 0, 0); if (!editorProcess.WaitForExit(500)) { NativeAPI.ShowWindow(editorWindow, NativeAPI.SW_RESTORE); NativeAPI.SetForegroundWindow(editorWindow); } }); } if (EditorContainer == null) { if (EditorContainer != null) { EditorContainer.Dispose(); EditorContainer = null; } } return(VSConstants.S_OK); }
protected override void Dispose(bool disposing) { try { if (disposing) { EditorContainer?.Dispose(); EditorContainer = null; GC.SuppressFinalize(this); } } finally { base.Dispose(disposing); } }