From 58cd85394aec43d67ea25c47394da0a9f6fc8629 Mon Sep 17 00:00:00 2001 From: Archeb Date: Fri, 24 Nov 2023 08:58:16 +0800 Subject: [PATCH] change executescript to async mode --- MainForm.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MainForm.cs b/MainForm.cs index d40fb60..47d2948 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -694,7 +694,7 @@ private void FocusMapPoint(int hopNo) { try { - mapWebView.ExecuteScript(@"window.opentrace.focusHop(" + hopNo + ");"); + mapWebView.ExecuteScriptAsync(@"window.opentrace.focusHop(" + hopNo + ");"); } catch (Exception e) { @@ -709,13 +709,13 @@ private void ResetMap() switch (mapWebView.Url.Host) { case "geo-devrel-javascript-samples.web.app": - mapWebView.ExecuteScript(OpenTrace.Properties.Resources.googleMap); + mapWebView.ExecuteScriptAsync(OpenTrace.Properties.Resources.googleMap); break; case "lbs.baidu.com": - mapWebView.ExecuteScript(OpenTrace.Properties.Resources.baiduMap); + mapWebView.ExecuteScriptAsync(OpenTrace.Properties.Resources.baiduMap); break; } - mapWebView.ExecuteScript("window.opentrace.reset(" + UserSettings.hideMapPopup.ToString().ToLower() + ")"); + mapWebView.ExecuteScriptAsync("window.opentrace.reset(" + UserSettings.hideMapPopup.ToString().ToLower() + ")"); } catch (Exception e) { MessageBox.Show($"Message: ${e.Message} \nSource: ${e.Source} \nStackTrace: ${e.StackTrace}", "Exception Occurred");