Esempio n. 1
0
        public void HandleDialog(BrowserNative.DialogType type, string text, string promptDefault = null)
        {
            if (type == BrowserNative.DialogType.DLT_HIDE)
            {
                Hide();
                return;
            }

            Show();

//		Debug.Log("HandleDialog " + type + " text " + text);

            switch (type)
            {
            case BrowserNative.DialogType.DLT_ALERT:
                dialogBrowser.CallFunction("showAlert", text);
                break;

            case BrowserNative.DialogType.DLT_CONFIRM:
                dialogBrowser.CallFunction("showConfirm", text);
                break;

            case BrowserNative.DialogType.DLT_PROMPT:
                dialogBrowser.CallFunction("showPrompt", text, promptDefault);
                break;

            case BrowserNative.DialogType.DLT_PAGE_UNLOAD:
                dialogBrowser.CallFunction("showConfirmNav", text);
                break;

            case BrowserNative.DialogType.DLT_PAGE_RELOAD:
                dialogBrowser.CallFunction("showConfirmReload", text);
                break;

            case BrowserNative.DialogType.DLT_GET_AUTH:
                dialogBrowser.CallFunction("showAuthPrompt", text);
                break;

            default:
                throw new ArgumentOutOfRangeException("type", type, null);
            }
        }
Esempio n. 2
0
        private static void CB_DisplayDialogFunc(
            int browserId, BrowserNative.DialogType dialogType, IntPtr textPtr,
            IntPtr promptTextPtr, IntPtr sourceURL
            )
        {
            var browser = GetBrowser(browserId);

            if (!browser)
            {
                return;
            }

            var text       = Util.PtrToStringUTF8(textPtr);
            var promptText = Util.PtrToStringUTF8(promptTextPtr);

            //var url = Util.PtrToStringUTF8(urlPtr);

            lock (browser.thingsToDo) browser.thingsToDo.Add(() => {
                    browser.CreateDialogHandler();
                    browser.dialogHandler.HandleDialog(dialogType, text, promptText);
                });
        }