public override async Task InitializeAsync(PermissionsContext permissionsContext = null) { await base.InitializeAsync(); var result = await GraphQLClient .Content .Query("blogPost", builder => { builder .WithField("contentItemId"); }); BlogPostContentItemId = result["data"]["blogPost"].First["contentItemId"].ToString(); var content = await Client.GetAsync($"api/content/{BlogPostContentItemId}"); OriginalBlogPost = await content.Content.ReadAsAsync <ContentItem>(); OriginalBlogPostVersionId = OriginalBlogPost.ContentItemVersionId; using (var shellScope = await ShellHost.GetScopeAsync(TenantName)) { await shellScope.UsingAsync(async scope => { var remoteClientService = scope.ServiceProvider.GetRequiredService <RemoteClientService>(); await remoteClientService.CreateRemoteClientAsync(RemoteDeploymentClientName, RemoteDeploymentApiKey); }); } }
public override async Task <ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext) { if (ShellScope.Context.Settings.Name != ShellHelper.DefaultShellName) { return(Outcomes("Failed")); } var tenantName = (await ExpressionEvaluator.EvaluateAsync(TenantName, workflowContext))?.Trim(); if (tenantName == ShellHelper.DefaultShellName) { return(Outcomes("Failed")); } if (!ShellHost.TryGetSettings(tenantName?.Trim(), out var shellSettings)) { return(Outcomes("Failed")); } if (shellSettings.State != TenantState.Running) { return(Outcomes("Failed")); } shellSettings.State = TenantState.Disabled; await ShellHost.UpdateShellSettingsAsync(shellSettings); return(Outcomes("Disabled")); }
public void Initialize() { BackBuffer += @"NayuTerm " + Assembly.GetExecutingAssembly().GetName().Version + "\r\n"; ShellHost.Initialize(@"cmd.exe"); ShellHost.Shell.OutputDataReceived += DataReceived; ShellHost.Shell.ErrorDataReceived += DataReceived; ShellHost.StartReadStdOut(); RunCommand.Initialized += RunCommand_Initialized; ForegroundColor = RunCommand.Environment.ForegroundColorARGB; BackgroundColor = RunCommand.Environment.BackgroundColorARGB; }
public new void Dispose() { ShellHost.Dispose(); base.Dispose(); }