public void SetDashboard(Dashboard dashboard) { if (dashboard == null) { return; } Dashboard = dashboard; SetRunspaceFactory(Dashboard.EndpointInitialSessionState); foreach (var endpoint in CmdletExtensions.HostState.EndpointService.Endpoints) { EndpointService.Register(endpoint.Value); } foreach (var endpoint in CmdletExtensions.HostState.EndpointService.RestEndpoints) { EndpointService.Register(endpoint); } CmdletExtensions.HostState.EndpointService.Endpoints.Clear(); CmdletExtensions.HostState.EndpointService.RestEndpoints.Clear(); if (ServiceProvider != null) { var manager = ServiceProvider.GetServices <IHostedService>().First(m => m is ScheduledEndpointManager) as ScheduledEndpointManager; var source = new CancellationTokenSource(); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed manager.StartAsync(source.Token); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed } }
public void SetRestEndpoints(Endpoint[] endpoints) { if (endpoints == null) { return; } foreach (var endpoint in endpoints) { EndpointService.Register(endpoint); } }
public void SetDashboard(Dashboard dashboard) { if (dashboard == null) { return; } Dashboard = dashboard; var dashboardBuilder = new DashboardBuilder(); var app = dashboardBuilder.Build(Dashboard); ElementScripts = app.ElementScripts; foreach (var endpoint in app.Endpoints.ToArray()) { EndpointService.Register(endpoint); } SetRunspaceFactory(Dashboard.InitializationScript); }