本文整理汇总了C#中System.Management.Automation.Runspaces.Runspace.OpenAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Runspace.OpenAsync方法的具体用法?C# Runspace.OpenAsync怎么用?C# Runspace.OpenAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Management.Automation.Runspaces.Runspace
的用法示例。
在下文中一共展示了Runspace.OpenAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PushRunspace
public void PushRunspace(Runspace runspace)
{
Runspaces.Push(runspace);
if (runspace.RunspaceAvailability != RunspaceAvailability.Available) runspace.OpenAsync();
}
示例2: OpenAsync
internal void OpenAsync()
{
// Always create runspace with WSManConnectionInfo.EnableNetworkAccess set to true.
WSManConnectionInfo copyConnectionInfo = ConnectionInfo.Copy();
copyConnectionInfo.EnableNetworkAccess = true;
// If the remote runspace is not available after crash/shutdown,
// activity task resume will fall back to reexecuting in a new runspace is assigned for the connection
if (!CheckAndReconnectAfterCrashOrShutdown(copyConnectionInfo))
{
_runspace = RunspaceFactory.CreateRunspace(copyConnectionInfo, null, LocalRunspaceProvider.SharedTypeTable);
_runspace.StateChanged += RunspaceStateChanged;
_tracer.WriteMessage("PSW Conn: Calling OpenAsync on runspace");
_runspace.OpenAsync();
}
}
示例3: DynamicPowershell
public DynamicPowershell() {
_runspace = RunspaceFactory.CreateRunspace();
if(_runspace.RunspaceStateInfo.State == RunspaceState.BeforeOpen) {
_runspace.OpenAsync();
}
_runspaceIsOwned = true;
}