public async Task <AverageSizes> getAverages(int seconds, IJSRuntime jSRuntime) { string serverUrl = Configuration["ServerUrl"]; controllerUrl = $"{serverUrl}api/BookColumns/"; await Task.Yield(); AverageSizes values = new AverageSizes(); #if tracing JSRuntimeExtensions.GroupTable(jSRuntime, values, "new AverageSizes"); #endif var url = $"{controllerUrl}getLtAverages/{seconds}"; try { values = await Http.GetFromJsonAsync <AverageSizes>(url); } //catch { } catch (System.Exception ex) { throw new System.Exception($"Check that tapeStream Server {controllerUrl} is running.", ex); } #if tracing JSRuntimeExtensions.GroupTable(jSRuntime, values, "AverageSizes values"); #endif return(values); }
public async Task <RatioFrame> getIncrementalRatioFrames(int seconds, int last, IJSRuntime jSRuntime) { string serverUrl = Configuration["ServerUrl"]; controllerUrl = $"{serverUrl}api/BookColumns/"; await Task.Yield(); var route = $"getIncrementalRatioFrames/{seconds}/{last}"; RatioFrame values = new RatioFrame(); #if tracing JSRuntimeExtensions.GroupTable(jSRuntime, values, "new AverageSizes"); #endif try { values = await Http.GetFromJsonAsync <RatioFrame>($"{controllerUrl}{route}"); } catch { } #if tracing JSRuntimeExtensions.GroupTable(jSRuntime, values, "AverageSizes Ratios values"); #endif return(values); }
public async Task <List <RatioFrame[]> > getAllRatioFrames(string symbol, double OADate, IJSRuntime jSRuntime) { //string serverUrl = Configuration["ServerUrl"]; string serverUrl = "http://localhost:55540/"; controllerUrl = $"{serverUrl}api/BookColumns/"; await Task.Yield(); var route = $"getAllRatioFrames/{symbol}/{OADate}"; List <RatioFrame[]> values = new List <RatioFrame[]>(); #if tracing JSRuntimeExtensions.GroupTable(jSRuntime, values, "new AverageSizes"); #endif try { var json = await Http.GetFromJsonAsync <string>($"{controllerUrl}{route}"); values = JsonSerializer.Deserialize <List <RatioFrame[]> >(json); } catch (System.Exception ex) { } #if tracing JSRuntimeExtensions.GroupTable(jSRuntime, values, "AverageSizes Ratios values"); #endif return(values); }
public async Task <AverageSizes> getLtRatios(int seconds, IJSRuntime jSRuntime) { string serverUrl = Configuration["ServerUrl"]; controllerUrl = $"{serverUrl}api/BookColumns/"; await Task.Yield(); AverageSizes values = new AverageSizes(); #if tracing JSRuntimeExtensions.GroupTable(jSRuntime, values, "new AverageSizes"); #endif try { values = await Http.GetFromJsonAsync <AverageSizes>($"{controllerUrl}getLtRatios/{seconds}"); } catch { } #if tracing JSRuntimeExtensions.GroupTable(jSRuntime, values, "AverageSizes Ratios values"); #endif return(values); }
private ValueTask <bool> InitializeChart(IJSRuntime jSRuntime, DotNetObjectReference <ChartAdapter> dotNetObjectReference, bool hasClickEvent, bool hasHoverEvent, string canvasId, ChartData <Point> data, LineChartOptions options, string dataJsonString, string optionsJsonString) { return(JSRuntimeExtensions.InvokeAsync <bool>(jSRuntime, "blazoriseCharts.initialize", new object[9] { dotNetObjectReference, hasClickEvent, hasHoverEvent, canvasId, "scatter", ToChartDataSet(data), options, dataJsonString, optionsJsonString })); }
/// <summary> /// Invoke the specified method with JSInterop and returns default(T) if the timeout is reached /// </summary> /// <param name="jsRuntime">js runtime on which we'll execute the query</param> /// <param name="identifier">method identifier</param> /// <param name="timeout">timeout until e return default(T)</param> /// <param name="args">method arguments</param> /// <typeparam name="T"></typeparam> /// <returns></returns> public static async ValueTask <T> InvokeOrDefaultAsync <T>(this IJSRuntime jsRuntime, string identifier, TimeSpan timeout, params object[] args) { try { return(await JSRuntimeExtensions.InvokeAsync <T>( jsRuntime : jsRuntime, identifier : identifier, timeout : timeout, args : args)); } catch (TaskCanceledException) { //when timeout is reached it raises an exception return(await Task.FromResult(default(T))); } }
public static void Warn(IJSRuntime js, object message) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.warn", message);
public static void Trace(IJSRuntime js) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.trace");
public static void TimeEnd(IJSRuntime js) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.timeEnd");
public static void Table(IJSRuntime js, object data) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.table", data);
public static void Log(IJSRuntime js, object input) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.log", input);
public static void Info(IJSRuntime js, object message) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.info", message);
public static void Error(IJSRuntime js, object message) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.error", message);
public static void Count(IJSRuntime js, string label = "") => JSRuntimeExtensions.InvokeVoidAsync(js, "console.count", label ?? null);
public static void Assert(IJSRuntime js, bool condition, object message) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.assert", new object[] { condition, message });
public static void Clear(IJSRuntime js) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.clear");
public static void GroupCollapsed(IJSRuntime js) => JSRuntimeExtensions.InvokeVoidAsync(js, "console.groupCollapsed");