private async Task <bool> PerformPowershellAsync(string command, bool importNavContainerHelper)
        {
            if (asyncScript.InvocationStateInfo.State == PSInvocationState.Running)
            {
                ErrorCallback?.Invoke(this, Resources.GlobalRessources.ErrorWaitForPreviousTask);
                return(false);
            }
            StringBuilder sb = new StringBuilder();

            if (importNavContainerHelper)
            {
                sb.AppendLine("import-module navcontainerhelper");
            }
            sb.AppendLine(command);
            asyncScript.AddScript(sb.ToString());
            StartScriptCallback?.Invoke(this, command);
            var result = asyncScript.BeginInvoke <PSObject, PSObject>(null, pso);
            await Task.Factory.FromAsync(result, x => { });

            if (asyncScript.HadErrors)
            {
                ErrorCallback?.Invoke(this, GlobalRessources.ErrorScriptCompletedWithError);
            }
            EndScriptCallback?.Invoke(this, null);
            return(true);
        }
 public void StopAllTasks()
 {
     asyncScript.Stop();
     EndScriptCallback?.Invoke(this, null);
 }