>();
if (currentWorkspace.Config.ShouldCompilex86) {
@@ -241,11 +248,7 @@ private async void tsbtnCompile_Click(object sender, EventArgs e) {
}
private async void tsbtnSave_Click(object sender, EventArgs e) {
- if (string.IsNullOrEmpty(currentWorkspace.SaveFilePath)) return;
- var workspaceState = await mainWebBrowser.BkySaveWorkspace();
- if (workspaceState == null) return;
- currentWorkspace.BlocklyXml = new FPXElement(workspaceState);
- currentWorkspace.SaveToFile();
+ await saveWorkspace();
}
private async void tsbtnCompileRun_Click(object sender, EventArgs e) {
diff --git a/BlocklyAtsGui/WebView/HttpServer.cs b/BlocklyAtsGui/WebView/HttpServer.cs
index c83e975..3f3d068 100644
--- a/BlocklyAtsGui/WebView/HttpServer.cs
+++ b/BlocklyAtsGui/WebView/HttpServer.cs
@@ -117,7 +117,7 @@ private async Task HandleIncomingConnections(CancellationToken cancelToken) {
resp.StatusCode = 404;
string errorMessageTemplate = @"
Error: 404 Not Found
-Please inform developer with these information: zbx1425@outlook.com
+Please inform developer with these information.
Missing Path | {0} |
diff --git a/BlocklyAtsGui/WebView/WebView2Browser.Reflection.cs b/BlocklyAtsGui/WebView/WebView2Browser.Reflection.cs
deleted file mode 100644
index 19e7ac6..0000000
--- a/BlocklyAtsGui/WebView/WebView2Browser.Reflection.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-using Microsoft.Web.WebView2.Core;
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace BlocklyAts {
- partial class WebView2Browser {
-
- [DllImport("kernel32.dll", SetLastError = true)]
- private static extern IntPtr LoadLibrary(string dllToLoad);
-
- private static void TryLoadWebview2Loader() {
- var FLoaderLoaded = typeof(CoreWebView2Environment)
- .GetField("webView2LoaderLoaded", BindingFlags.Static | BindingFlags.NonPublic);
- if (!(bool)FLoaderLoaded.GetValue(null)) {
- string frameworkDescription = RuntimeInformation.FrameworkDescription;
- if (frameworkDescription.StartsWith(".NET Framework")) {
- string localPath = new Uri(typeof(CoreWebView2Environment).Assembly.CodeBase).LocalPath;
- string directoryName = Path.GetDirectoryName(localPath);
- string arch;
- switch (RuntimeInformation.ProcessArchitecture) {
- case Architecture.X86:
- arch = "x86";
- break;
- case Architecture.X64:
- arch = "x64";
- break;
- case Architecture.Arm64:
- arch = "arm64";
- break;
- default:
- throw new NotSupportedException(
- string.Format("{0} bit WebView2Loader.dll is not supported", RuntimeInformation.ProcessArchitecture)
- );
- }
- string dllName = "WebView2Loader." + arch + ".dll";
- if (File.Exists(dllName)) {
- File.Copy(dllName, "WebView2Loader.dll", true);
- if (LoadLibrary("WebView2Loader.dll") == IntPtr.Zero) {
- int hrforLastWin32Error = Marshal.GetHRForLastWin32Error();
- Marshal.ThrowExceptionForHR(hrforLastWin32Error);
- } else {
- FLoaderLoaded.SetValue(null, true);
- }
- }
- }
- }
- }
- }
-}
diff --git a/BlocklyAtsGui/WebView/WebView2Browser.cs b/BlocklyAtsGui/WebView/WebView2Browser.cs
index 5341003..4803dc7 100644
--- a/BlocklyAtsGui/WebView/WebView2Browser.cs
+++ b/BlocklyAtsGui/WebView/WebView2Browser.cs
@@ -18,14 +18,10 @@ partial class WebView2Browser : BaseBrowser {
private WebView2 browser;
public WebView2Browser(string url = "about:blank") {
- // Use an alternative path for WebView2 Loader, for a better appearance
- // Might remove it if it causes troubles
- TryLoadWebview2Loader();
-
browser = new WebView2();
browser.NavigationCompleted += Browser_DocumentCompleted;
- var createTask = CoreWebView2Environment.CreateAsync();
+ var createTask = CoreWebView2Environment.CreateAsync(null, PreferenceManager.WebView2UserDataPath, null);
createTask.Wait();
environment = createTask.Result;
browser.CoreWebView2Ready += (sender, e) => {
@@ -86,7 +82,7 @@ private void CoreWebView2_WebResourceRequested(object sender, CoreWebView2WebRes
} else {
string errorMessageTemplate = @"
Error: 404 Not Found
-Please inform developer with these information: zbx1425@outlook.com
+Please inform developer with these information.