public void Post(string submissionUrl, BacktraceJObject jObject, Action <long, bool, string> onComplete) { NumberOfRequests++; Called = true; OnInvoke?.Invoke(submissionUrl, jObject); onComplete?.Invoke(StatusCode, IsHttpError, Response); }
protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { InvokeWasCalled = true; if (OnInvoke != null) { await OnInvoke.Invoke(request); } return(Response); }
/// <summary> /// Invokes the given command. /// </summary> /// <param name="command">The command to invoke.</param> /// <returns>The return value, if any, of the invoked command.</returns> public object InvokeCommand(string command) { object commandResult = null; if (!string.IsNullOrWhiteSpace(command)) { string commandLog = $"> {command}"; if (_theme) { commandLog = commandLog.ColorText(_theme.CommandLogColor); } LogToConsole(commandLog); string logTrace = string.Empty; try { commandResult = QuantumConsoleProcessor.InvokeCommand(command); switch (commandResult) { case Task task: _currentTasks.Add(task); break; case IEnumerator <ICommandAction> action: StartAction(action); break; case IEnumerable <ICommandAction> action: StartAction(action.GetEnumerator()); break; default: logTrace = Serialize(commandResult); break; } } catch (System.Reflection.TargetInvocationException e) { logTrace = GetInvocationErrorMessage(e.InnerException); } catch (Exception e) { logTrace = GetErrorMessage(e); } LogToConsole(logTrace); OnInvoke?.Invoke(command); if (_autoScroll == AutoScrollOptions.OnInvoke) { ScrollConsoleToLatest(); } if (_closeOnSubmit) { Deactivate(); } } else { OverrideConsoleInput(string.Empty); } return(commandResult); }
/// <summary> /// Invokes the given command. /// </summary> /// <param name="command">The command to invoke.</param> /// <returns>The return value, if any, of the invoked command.</returns> public object InvokeCommand(string command) { object commandResult = null; if (!string.IsNullOrWhiteSpace(command)) { string commandLog = $"> {command}"; if (_theme) { commandLog = commandLog.ColorText(_theme.CommandLogColor); } LogToConsole(commandLog); string logTrace = string.Empty; try { commandResult = QuantumConsoleProcessor.InvokeCommand(command); if (commandResult is Task task) { _currentTasks.Add(task); } else { logTrace = _serializer.SerializeFormatted(commandResult, _theme); } } catch (System.Reflection.TargetInvocationException e) { logTrace = GetInvocationErrorMessage(e.InnerException); } catch (Exception e) { logTrace = GetErrorMessage(e); } LogToConsole(logTrace); OnInvoke?.Invoke(command); if (_autoScroll == AutoScrollOptions.OnInvoke) { ScrollConsoleToLatest(); } if (_closeOnSubmit) { Deactivate(); } } else { OverrideConsoleInput(string.Empty); } return(commandResult); }
public override void Invoke(ICommandManager commandManager) => OnInvoke?.Invoke(commandManager);
public void Invoke() { OnInvoke.Invoke(); }
public object Invoke(XsltContext xsltContext, object[] args, XPathNavigator docContext) { return(OnInvoke?.Invoke(args)); }