void OnWebHostAlert(object sender, Mono.WebBrowser.AlertEventArgs e) { switch (e.Type) { case Mono.WebBrowser.DialogType.Alert: MessageBox.Show(e.Text, e.Title); break; case Mono.WebBrowser.DialogType.AlertCheck: WebBrowserDialogs.AlertCheck form1 = new WebBrowserDialogs.AlertCheck(e.Title, e.Text, e.CheckMessage, e.CheckState); form1.Show(); e.CheckState = form1.Checked; e.BoolReturn = true; break; case Mono.WebBrowser.DialogType.Confirm: DialogResult r1 = MessageBox.Show(e.Text, e.Title, MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); e.BoolReturn = (r1 == DialogResult.OK); break; case Mono.WebBrowser.DialogType.ConfirmCheck: WebBrowserDialogs.ConfirmCheck form2 = new WebBrowserDialogs.ConfirmCheck(e.Title, e.Text, e.CheckMessage, e.CheckState); DialogResult r2 = form2.Show(); e.CheckState = form2.Checked; e.BoolReturn = (r2 == DialogResult.OK); break; case Mono.WebBrowser.DialogType.ConfirmEx: MessageBox.Show(e.Text, e.Title); break; case Mono.WebBrowser.DialogType.Prompt: WebBrowserDialogs.Prompt form4 = new WebBrowserDialogs.Prompt(e.Title, e.Text, e.Text2); DialogResult r4 = form4.Show(); e.StringReturn = form4.Text; e.BoolReturn = (r4 == DialogResult.OK); break; case Mono.WebBrowser.DialogType.PromptPassword: MessageBox.Show(e.Text, e.Title); break; case Mono.WebBrowser.DialogType.PromptUsernamePassword: MessageBox.Show(e.Text, e.Title); break; case Mono.WebBrowser.DialogType.Select: MessageBox.Show(e.Text, e.Title); break; } }
public bool OnSelect (IntPtr title, IntPtr text, uint count, IntPtr list, out int retVal) { #if debug OnGeneric ("OnSelect"); Console.Error.WriteLine ("OnSelect"); #endif retVal = 0; AlertEventHandler eh = (AlertEventHandler) (owner.Events[WebBrowser.AlertEvent]); if (eh != null) { AlertEventArgs e = new AlertEventArgs (); e.Type = DialogType.Select; if (title != IntPtr.Zero) e.Title = Marshal.PtrToStringUni (title); if (text != IntPtr.Zero) e.Text = Marshal.PtrToStringUni (text); eh (this, e); return e.BoolReturn; } return false; }
public bool OnPromptPassword (IntPtr title, IntPtr text, IntPtr chkMsg, ref bool chkState, out IntPtr password) { #if debug OnGeneric ("OnPromptPassword"); Console.Error.WriteLine ("OnPromptPassword"); #endif password = IntPtr.Zero; AlertEventHandler eh = (AlertEventHandler) (owner.Events[WebBrowser.AlertEvent]); if (eh != null) { AlertEventArgs e = new AlertEventArgs (); e.Type = DialogType.PromptPassword; if (title != IntPtr.Zero) e.Title = Marshal.PtrToStringUni (title); if (text != IntPtr.Zero) e.Text = Marshal.PtrToStringUni (text); if (chkMsg != IntPtr.Zero) e.CheckMessage = Marshal.PtrToStringUni (chkMsg); e.CheckState = chkState; eh (this, e); return e.BoolReturn; } return false; }
public bool OnPrompt (IntPtr title, IntPtr text, ref IntPtr retVal) { #if debug OnGeneric ("OnPrompt"); Console.Error.WriteLine ("OnPrompt"); #endif AlertEventHandler eh = (AlertEventHandler) (owner.Events[WebBrowser.AlertEvent]); if (eh != null) { AlertEventArgs e = new AlertEventArgs (); e.Type = DialogType.Prompt; if (title != IntPtr.Zero) e.Title = Marshal.PtrToStringUni (title); if (text != IntPtr.Zero) e.Text = Marshal.PtrToStringUni (text); if (retVal != IntPtr.Zero) e.Text2 = Marshal.PtrToStringUni (retVal); eh (this, e); retVal = Marshal.StringToHGlobalUni (e.StringReturn); return e.BoolReturn; } return false; }
public bool OnConfirmEx (IntPtr title, IntPtr text, DialogButtonFlags flags, IntPtr title0, IntPtr title1, IntPtr title2, IntPtr chkMsg, ref bool chkState, out Int32 retVal) { #if debug OnGeneric ("OnConfirmEx"); Console.Error.WriteLine ("OnConfirmEx"); #endif retVal = -1; AlertEventHandler eh = (AlertEventHandler) (owner.Events[WebBrowser.AlertEvent]); if (eh != null) { AlertEventArgs e = new AlertEventArgs (); e.Type = DialogType.ConfirmEx; if (title != IntPtr.Zero) e.Title = Marshal.PtrToStringUni (title); if (text != IntPtr.Zero) e.Text = Marshal.PtrToStringUni (text); if (chkMsg != IntPtr.Zero) e.CheckMessage = Marshal.PtrToStringUni (chkMsg); e.CheckState = chkState; eh (this, e); chkState = e.CheckState; return e.BoolReturn; } return false; }
public bool OnConfirm (IntPtr title, IntPtr text) { #if debug OnGeneric ("OnConfirm"); Console.Error.WriteLine ("OnConfirm"); #endif AlertEventHandler eh = (AlertEventHandler) (owner.Events[WebBrowser.AlertEvent]); if (eh != null) { AlertEventArgs e = new AlertEventArgs (); e.Type = DialogType.Confirm; if (title != IntPtr.Zero) e.Title = Marshal.PtrToStringUni (title); if (text != IntPtr.Zero) e.Text = Marshal.PtrToStringUni (text); eh (this, e); return e.BoolReturn; } return false; }
public void OnAlert (IntPtr title, IntPtr text) { #if debug OnGeneric ("OnAlert"); Console.Error.WriteLine ("OnAlert"); #endif AlertEventHandler eh = (AlertEventHandler) (owner.Events[WebBrowser.AlertEvent]); if (eh != null) { AlertEventArgs e = new AlertEventArgs (); e.Type = DialogType.Alert; if (title != IntPtr.Zero) e.Title = Marshal.PtrToStringUni (title); if (text != IntPtr.Zero) e.Text = Marshal.PtrToStringUni (text); eh (this, e); } }