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