Exemplo n.º 1
0
        public async Task <IRSession> StartSessionAsync(CancellationToken ct)
        {
            if (RSession == null)
            {
                var workflow = _services.GetService <IRInteractiveWorkflowProvider>().GetOrCreate();
                RSession = workflow.RSessions.GetOrCreate(_sessionId);
            }
            else
            {
                await _sessionStart;
            }

            if (!RSession.IsHostRunning)
            {
                var settings = _services.GetService <IRSettings>();
                await RSession.EnsureHostStartedAsync(new RHostStartupInfo(isInteractive : true), SessionCallback, 3000, ct);

                await RSession.SetVsCranSelectionAsync(CranMirrorList.UrlFromName(settings.CranMirror), ct);

                await RSession.SetCodePageAsync(settings.RCodePage, ct);

                await RSession.SetVsGraphicsDeviceAsync();
            }

            return(RSession);
        }