Exemple #1
0
        private bool OnConfirmMessage(IntPtr webView, IntPtr param, IntPtr msg)
        {
            string message = ExtApi.GetWkeString(msg);
            var    res     = MessageBox.Show(message, "提示", MessageBoxButtons.OKCancel);

            return(DialogResult.OK == res ? true : false);
        }
Exemple #2
0
 private bool OnNavigation(IntPtr webView, IntPtr param, wkeNavigationType navigationType, IntPtr urlPtr)
 {
     if (Navigation != null)
     {
         var c   = (int)navigationType;
         var url = ExtApi.GetWkeString(urlPtr);
         var res = Navigation(this, (NavigationType)c, url);
         if (res)
         {
             List <Control> controls = new List <Control>();
             foreach (Control cs in Controls)
             {
                 controls.Add(cs);
             }
             Controls.Clear();
             foreach (var item in controls)
             {
                 //释放通过js创建的控件
                 item.Dispose();
             }
             Browser.Current.ClearViewObject(_webView);
         }
         return(res);
     }
     return(true);
 }
Exemple #3
0
        private void OnTitleChange(IntPtr webView, IntPtr param, IntPtr titlePtr)
        {
            string title = ExtApi.GetWkeString(titlePtr);

            if (TitleChanged != null)
            {
                TitleChanged(this, title);
            }
        }
Exemple #4
0
        private void OnLoadingFinish(IntPtr webView, IntPtr param,
                                     IntPtr urlPtr, wkeLoadingResult result, IntPtr failedReasonPtr)
        {
            string url          = ExtApi.GetWkeString(urlPtr);
            string failedReason = ExtApi.GetWkeString(failedReasonPtr);

            if (LoadingComplete != null)
            {
                LoadingComplete(this, url, failedReason, (UrlLoadResult)result);
            }
        }
Exemple #5
0
        private void OnConsel(IntPtr webView, IntPtr param, wkeConsoleLevel level,
                              IntPtr messagePtr, IntPtr sourceNamePtr, uint sourceLine, IntPtr stackTracePtr)
        {
            string message    = ExtApi.GetWkeString(messagePtr);
            string sourceName = ExtApi.GetWkeString(sourceNamePtr);
            string stackTrace = ExtApi.GetWkeString(stackTracePtr);

            if (ConselMessage != null)
            {
                ConselMessage(this, message, sourceName, (int)sourceLine, stackTrace);
            }
        }
Exemple #6
0
        private bool OnAlertMessage(IntPtr webView, IntPtr param, IntPtr msg)
        {
            string message = ExtApi.GetWkeString(msg);

            return(DialogResult.OK == MessageBox.Show(message));
        }