Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 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)));
     }
 }
Exemple #7
0
 public static void Warn(IJSRuntime js, object message) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.warn", message);
Exemple #8
0
 public static void Trace(IJSRuntime js) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.trace");
Exemple #9
0
 public static void TimeEnd(IJSRuntime js) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.timeEnd");
Exemple #10
0
 public static void Table(IJSRuntime js, object data) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.table", data);
Exemple #11
0
 public static void Log(IJSRuntime js, object input) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.log", input);
Exemple #12
0
 public static void Info(IJSRuntime js, object message) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.info", message);
Exemple #13
0
 public static void Error(IJSRuntime js, object message) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.error", message);
Exemple #14
0
 public static void Count(IJSRuntime js, string label = "") =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.count", label ?? null);
Exemple #15
0
 public static void Assert(IJSRuntime js, bool condition, object message) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.assert", new object[] { condition, message });
Exemple #16
0
 public static void Clear(IJSRuntime js) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.clear");
Exemple #17
0
 public static void GroupCollapsed(IJSRuntime js) =>
 JSRuntimeExtensions.InvokeVoidAsync(js, "console.groupCollapsed");