public void SimulateChangeWorkspace(IPythonWorkspaceContext context)
 {
     WorkspaceClosing?.Invoke(this, new PythonWorkspaceContextEventArgs(Workspace));
     WorkspaceClosed?.Invoke(this, new PythonWorkspaceContextEventArgs(Workspace));
     Workspace = context;
     WorkspaceOpening?.Invoke(this, new PythonWorkspaceContextEventArgs(Workspace));
     WorkspaceInitialized?.Invoke(this, new PythonWorkspaceContextEventArgs(Workspace));
 }
 private void CloseCurrentContext()
 {
     lock (_currentContextLock) {
         var current = _currentContext;
         if (current != null)
         {
             WorkspaceClosing?.Invoke(this, new PythonWorkspaceContextEventArgs(current));
             current.Dispose();
             WorkspaceClosed?.Invoke(this, new PythonWorkspaceContextEventArgs(current));
         }
         _currentContext = null;
     }
 }