public async void loadFileFast() { ResetBinaryInfo(); if (await LBDJsInterop.HasFile("fileUpload")) { await CounterHelper.CmdAddCounter(new TSCounter() { Source = navigationManager.Uri, Action = "ClickButtonFast" }); _BinaryInfo.progressInfo = "started"; log.Add("started"); BlazorTimeAnalyzer.Reset("Fast mode"); BlazorTimeAnalyzer.Add("reading in js", MethodBase.GetCurrentMethod()); _BinaryInfo.progressInfo = "js is loading file..."; log.Add("js is loading file..."); StateHasChanged(); await LBDJsInterop.ReadFile(_BinaryInfo.variableName, "fileUpload"); } else { await LBDJsInterop.Alert("Please select file"); } }
public async void loadFileRegular() { log.Clear(); if (await LBDJsInterop.HasFile("fileUpload")) { await CounterHelper.CmdAddCounter(new TSCounter() { Source = navigationManager.Uri, Action = "ClickButtonRegular" }); BlazorTimeAnalyzer.Reset("Regular mode"); log.Add("started"); log.Add("js is loading file..."); StateHasChanged(); BlazorTimeAnalyzer.Add("set data", MethodBase.GetCurrentMethod()); string a = await LBDJsInterop.GetFile(_BinaryInfo.variableName, "fileUpload"); log.Add(a); log.Add(".net loaded " + a.Length + " bytes"); log.Add("done"); BlazorTimeAnalyzer.LogAll(); StateHasChanged(); } else { await LBDJsInterop.Alert("Please select file"); } }
//protected override void OnInitialized() //{ // base.OnInitialized(); //} public async void JsSendMessage() { if (!string.IsNullOrEmpty(JsMessage)) { await CounterHelper.CmdAddCounter(new TSCounter() { Source = navigationManager.Uri, Action = "ClickButtonRegular" }); ExpandData(); log.Add(JsMessage); BlazorTimeAnalyzer.Reset(); BlazorTimeAnalyzer.Add("set data", MethodBase.GetCurrentMethod()); await LBDJsInterop.SetData("myTmpVar1", JsMessage); BlazorTimeAnalyzer.Add("process data", MethodBase.GetCurrentMethod()); LBDJsInterop.ProcessData("myTmpVar1"); BlazorTimeAnalyzer.Add("get data", MethodBase.GetCurrentMethod()); log.Add(await LBDJsInterop.GetData("myTmpVar1")); BlazorTimeAnalyzer.LogAll(); JsMessage = string.Empty; } else { await LBDJsInterop.Alert("Please input message"); } StateHasChanged(); }
public async void JsFastDataExchanger_OnMessage(string msg) { if (msg.Equals("fileloadingdone")) { log.Add("js loaded " + _BinaryInfo.dataLenght + " bytes"); await InvokeAsync(StateHasChanged); BlazorTimeAnalyzer.Add("reading in .net", MethodBase.GetCurrentMethod()); double gb = BJSFDEHelperMethods.ConvertSize(_BinaryInfo.dataLenght, BJSFDEHelperMethods.SizeUnit.gb); if (gb > 1.0) { _BinaryInfo.chunkSize = (int)(_BinaryInfo.dataLenght / 50.0); await _BinaryInfo.LoadByPortionsAsync(); } else { await _BinaryInfo.LoadEntirelyAsync(); } } }
public async static void Authorize(string ParUserName, string ParPassword) { LocalData.CurrJWT = string.Empty; BlazorTimeAnalyzer.DevelopmentMode = !LocalData.ProductionOrDevelopmentMode; BlazorTimeAnalyzer.Reset(); BlazorTimeAnalyzer.LogAllAddition = true; BlazorTimeAnalyzer.Add("A1", MethodBase.GetCurrentMethod()); timerHelper.Stop(); if (await WebApi.CmdGetJWT(GlobalFunctions.ConvertToSecureString(ParUserName), GlobalFunctions.ConvertToSecureString(ParPassword), WebApiUserTypesEnum.Authorized)) { BlazorTimeAnalyzer.Add("A2", MethodBase.GetCurrentMethod()); TSUser tmpTSUser = new TSUser { UserName = ParUserName, Password = ParPassword, }; BlazorTimeAnalyzer.Add("A2", MethodBase.GetCurrentMethod()); LocalData.CurrTSUser = await WebApiFunctions.CmdTSUserAuthorize(tmpTSUser); BlazorTimeAnalyzer.Add("A3", MethodBase.GetCurrentMethod()); if (LocalData.CurrTSUser.UserName.ToLower().Equals("error!")) { LocalData.AppHasGlobalError = true; AddError(LocalData.CurrTSUser.FullName, MethodBase.GetCurrentMethod(), true, false); } else { LocalData.IsAuthenticated = !LocalData.CurrTSUser.ID.Equals(Guid.Empty); if (LocalData.IsAuthenticated) { timerHelper.OnTick = TimerTick; timerHelper.Start(1, 10000); BlazorTimeAnalyzer.Add("A4", MethodBase.GetCurrentMethod()); await WebApiFunctions.CmdGetFeedback(); BlazorTimeAnalyzer.Add("A5", MethodBase.GetCurrentMethod()); await WebApiFunctions.CmdGetReaction(); BlazorTimeAnalyzer.Add("A6", MethodBase.GetCurrentMethod()); LocalData.LoginLogout = LocalData.CurrTSUser.UserName; LocalData.btModal.Close(); CmdNavigate("DesktopPage"); LocalData.EventConsumerName = "TodosPage"; LocalData.componentBridge.InvokeRefresh(); LocalData.compHeader.Refresh(); LocalData.AppHasGlobalError = false; BlazorTimeAnalyzer.Add("A7", MethodBase.GetCurrentMethod()); } else { bool b = await WebApi.CmdGetJWT(LocalData.ServerNotAuthorizedUserName, LocalData.ServerNotAuthorizedUserPass, WebApiUserTypesEnum.NotAuthorized); if (b) { timerHelper.OnTick = TimerTick; timerHelper.Start(1, 10000); } LocalData.AppHasGlobalError = true; } } } BlazorTimeAnalyzer.LogAll(); }