Beispiel #1
0
 private static void InitSharedPool()
 {
     if (_sharedRunspacePool == null)
     {
         _sharedRunspacePool = new OnDisposable <RunspacePool>(RunspaceFactory.CreateRunspacePool());
         _sharedRunspacePool.Value.Open();
     }
 }
Beispiel #2
0
 public DynamicPowershell(OnDisposable <RunspacePool> pool = null)
 {
     if (pool == null)
     {
         InitSharedPool();
         pool = _sharedRunspacePool;
     }
     _runspacePool = pool;
     Reset();
     RefreshCommandList();
 }
Beispiel #3
0
 public void Dispose()
 {
     _runspacePool = null; // will call dispose if this is the last instance using it.
 }