Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
            }
        }
Example #6
0
        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);
        }