public WinformBrowser(string url = "about:blank") { if (!PlatformFunction.IsMono) { try { PlatformFunction.SetWebBrowserFeatures(); CoInternetSetFeatureEnabled(FEATURE_LOCALMACHINE_LOCKDOWN, SET_FEATURE_ON_PROCESS, false); } catch { // No need to handle registry errors } } browser = new WebBrowser { IsWebBrowserContextMenuEnabled = false, AllowWebBrowserDrop = false, ScriptErrorsSuppressed = false, WebBrowserShortcutsEnabled = false }; browser.DocumentCompleted += Browser_DocumentCompleted; browser.PreviewKeyDown += Browser_PreviewKeyDown; browser.ObjectForScripting = new ScriptManager(this); if (url != "about:blank") { browser.Navigate(new Uri(url)); } }
private void tsbtnUserConfig_Click(object sender, EventArgs e) { var result = new FormUserConfig().ShowDialog(); if (result == DialogResult.Abort) { // How can I stop WebView2 from occupying the files? // I cannot delete the entire DataDirectory mainWebBrowser.Dispose(); if (File.Exists(PreferenceManager.PreferencePath)) { File.Delete(PreferenceManager.PreferencePath); } if (!PlatformFunction.IsMono) { PlatformFunction.UnsetWebBrowserFeatures(); } PreferenceManager.Current = null; Application.Exit(); } if (PreferenceManager.Current != null) { updateTitleAndSaveBtn(); } }
private void InfoLabel_LinkClicked(object sender, EventArgs e) { if (TargetUrl != null && !browserReady) { PlatformFunction.CallBrowser(TargetUrl); } }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PlatformFunction.CallBrowser("https://www.zbx1425.cn"); }
private void tsbtnHelp_Click(object sender, EventArgs e) { PlatformFunction.CallBrowser("https://www.zbx1425.cn/nautilus/blocklyats"); }
private void llbEmail_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PlatformFunction.CallBrowser("mailto:[email protected]?subject=BlocklyAts%20Bug%20Report"); }
private void llbTwitter_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PlatformFunction.CallBrowser("https://twitter.com/messages/compose?recipient_id=797350934653210624"); }
private void llbGithub_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { PlatformFunction.CallBrowser("https://github.com/zbx1425/BlocklyAts/issues/new"); }