private void DispatchOnMainThreadAsync(Func <Task> callback) { _coreShell.DispatchOnMainThreadAsync(callback) .Unwrap() .SilenceException <OperationCanceledException>() .DoNotWait(); }
public async Task <ExecutionResult> InitializeAsync() { try { if (!Session.IsHostRunning) { await Session.StartHostAsync(new RHostStartupInfo { Name = "REPL", RBasePath = _settings.RBasePath, RHostCommandLineArguments = _settings.RCommandLineArguments, CranMirrorName = _settings.CranMirror, WorkingDirectory = _settings.WorkingDirectory }); } return(ExecutionResult.Success); } catch (RHostBinaryMissingException) { await _coreShell.DispatchOnMainThreadAsync(() => _coreShell.ShowErrorMessage(Resources.Error_Microsoft_R_Host_Missing)); return(ExecutionResult.Failure); } catch (Exception) { return(ExecutionResult.Failure); } }