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));
 }
 /// <summary>
 ///     Clears this workspace of nodes, notes, and connectors.
 /// </summary>
 public override void Clear()
 {
     WorkspaceClosed?.Invoke();
     base.Clear();
     PreloadedTraceData = null;
     RunSettings.Reset();
     EvaluationCount = 0;
 }
 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;
     }
 }