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