コード例 #1
0
        public async void loadFileRegular()
        {
            log.Clear();

            if (await _LocalJsInterop.HasFile("fileUpload"))
            {
                BWHTimeAnalyzer.Reset("Regular mode");

                log.Add("started");
                log.Add("js is loading file...");
                StateHasChanged();

                BWHTimeAnalyzer.Add("A1", MethodBase.GetCurrentMethod());

                string a = await _LocalJsInterop.GetFile(_BinaryInfo.variableName, "fileUpload");

                log.Add(a);

                log.Add(".net loaded " + a.Length + " bytes");
                log.Add("done");

                BWHTimeAnalyzer.LogAll();
                StateHasChanged();
            }
            else
            {
                await _LocalJsInterop.Alert("Please select file");
            }
        }
コード例 #2
0
        public async void JsSendMessage()
        {
            if (!string.IsNullOrEmpty(JsMessage))
            {
                ExpandData();

                log.Add(JsMessage);


                BWHTimeAnalyzer.Reset();
                BWHTimeAnalyzer.Add("A1", MethodBase.GetCurrentMethod());
                await _LocalJsInterop.SetData("myTmpVar1", JsMessage);

                BWHTimeAnalyzer.Add("A2", MethodBase.GetCurrentMethod());
                _LocalJsInterop.ProcessData("myTmpVar1");


                BWHTimeAnalyzer.Add("A3", MethodBase.GetCurrentMethod());
                log.Add(await _LocalJsInterop.GetData("myTmpVar1"));

                BWHTimeAnalyzer.LogAll();


                JsMessage = string.Empty;
            }
            else
            {
                await _LocalJsInterop.Alert("Please input message");
            }


            StateHasChanged();
        }