using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace AIProofread.Controls { [ClassInterface(ClassInterfaceType.AutoDual)] [ComVisible(true)] public partial class FormLogin : BaseWinForm { public event EventHandler OnLoginCompleted; private string action = "default"; public FormLogin() { InitializeComponent(); this.FormClosed += (s, e) => { // 关闭时释放资源 try { if (web != null) { web.Dispose(); web = null; } } catch { }; }; //Bridge.InitWebEnvAsync("login", web); //Bridge.AddEventHandler(BridgeEvent.LoginSuccess, OnLoginSuccess); } public FormLogin(string action) { this.action = action; InitializeComponent(); this.FormClosed += (s, e) => { // 关闭时释放资源 try { if (web != null) { web.Dispose(); web = null; } } catch { }; }; } private void OnLoginSuccess(object sender, EventArgs e) { OnLoginCompleted?.Invoke(this, e); } private void FormLogin_Load(object sender, EventArgs e) { //this.web.Source = new Uri(Config.WebPath("#login")); var r = new FormLogin(); InitWebView(web, Config.WebPath("login?action=" + this.action + "&version=" + Config.APP_VERSION + "&t=" + DateTime.Now.Ticks), "login"); } } }