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();
            //Bridge.InitWebEnvAsync("login", web);
            //Bridge.AddEventHandler(BridgeEvent.LoginSuccess, OnLoginSuccess);
        }
        public FormLogin(string action)
        {
            this.action = action;
            InitializeComponent();
        }

        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");
        }


    }
}
