Beispiel #1
0
 private async void WebBrowser_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
     try
     {
         if (bCancel == true)
         {
             e.Cancel = true;
             bCancel  = false;
         }
         else
         {
             if (e.Url.AbsolutePath != "blank")
             {
                 if (IsSkip(e.Url.AbsolutePath))
                 {
                     return;
                 }
                 currentUri = new Uri(currentUri, e.Url.AbsolutePath);
                 if (currentUri.IsAbsoluteUri || currentUri.IsFile)
                 {
                     await new Action(() => {
                         GetHtmlContents(currentUri);
                     }).InvokeAsync();
                 }
                 e.Cancel = true;
             }
         }
     }
     catch (Exception ex) { ex.ERROR(); }
 }
Beispiel #2
0
        private void NavigatingEventHandler(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            // default page - allow navigation to proceed
            if (e.Url.OriginalString == "about:blank")
            {
                return;
            }

            if (e.Url.OriginalString.StartsWith("action:"))
            {
                e.Cancel = true;    // cancel the webbrowser navigation

                ActionModelNode embeddedActionModel = GetEmbeddedActionModel();
                if (embeddedActionModel != null)
                {
                    // need to find the action in the model that matches the uri path
                    // TODO clean this up - this is a bit of hack right now
                    ActionPath uriPath = new ActionPath(e.Url.LocalPath, null);
                    foreach (ActionModelNode child in embeddedActionModel.ChildNodes)
                    {
                        // not currently used
                        //if(child.Action.Path.LastSegment.ResourceKey == uriPath.LastSegment.ResourceKey)
                        //{
                        //    ((IClickAction)child.Action).Click();
                        //    break;
                        //}
                    }
                }
            }
        }
Beispiel #3
0
        private void renderer_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            if (!(e.Url.ToString().Equals("about:blank", StringComparison.InvariantCultureIgnoreCase)))
            {
                var inputUrl = e.Url.ToString();

                if (inputUrl.StartsWith("http") && !inputUrl.StartsWith("http://localhost"))
                {
                    System.Diagnostics.Process.Start(inputUrl);
                }
                else if (inputUrl.StartsWith("revit"))
                {
                    e.Cancel = true;
                    ScriptConsoleUtils.ProcessUrl(_uiApp, inputUrl);
                    return;
                }
                else if (inputUrl.StartsWith("file"))
                {
                    e.Cancel = false;
                    return;
                }

                e.Cancel = true;
            }
        }
 private void Browser_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
     if (string.IsNullOrEmpty(e.Url.Fragment) && e.Url.Host != null && e.Url.Host.EndsWith("msdn.microsoft.com"))
     {
         e.Cancel = true;
         ThreadHelper.Generic.InvokeAsync(() => _browser.Navigate(e.Url.AbsoluteUri + "#content"));
     }
 }
Beispiel #5
0
        private void NavigatingEventHandler(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.OriginalString.StartsWith("action:"))
            {
                e.Cancel = true;                    // cancel the webbrowser navigation

                _component.InvokeAction(e.Url.LocalPath);
            }
        }
Beispiel #6
0
 private void WebBrowser_OnNavigating(object sender,
                                      System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
     if (!e.Url.ToString().StartsWith("about:blank"))
     {
         e.Cancel = true;
         Process.Start(e.Url.ToString());
     }
 }
Beispiel #7
0
        void htmlText_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            if (e.Url.Scheme == "file" || e.Url.Scheme == "about")
            {
                return;
            }

            System.Diagnostics.Process p = System.Diagnostics.Process.Start(e.Url.ToString());

            e.Cancel = true;
        }
Beispiel #8
0
        void WebView_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            String viewRoot  = "views\\";
            String disponent = e.Url.ToString().Split(':')[0];
            String app       = e.Url.ToString().Split(':')[1];
            String argument  = e.Url.ToString().Replace(disponent + ":" + app + ":", "");

            using (StreamReader SR = new StreamReader(viewRoot + argument + ".xml"))
            {
                RawCode = SR.ReadToEnd();
                Source  = mMakoEngine.Preprocess(SR.ReadToEnd(), argument, false, disponent + ":" + app + ":" + argument, false);
            }
        }
Beispiel #9
0
 protected override void OnNavigating(System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
     if (!_isFromBrowser)
     {
         base.OnNavigating(e);
         _isFromBrowser = true;
     }
     else
     {
         _mainForm.openFile(e.Url.LocalPath);
         e.Cancel = true;
         base.OnNavigating(e);
     }
 }
Beispiel #10
0
 private void wbTwitchAuth_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
     Utils.clearIECache();
     MessageBox.Show(e.Url.AbsoluteUri);
     if (e.Url.Host.Trim() == "localhost")
     {
         if (_isStreamer)
         {
             Config.StreamerOAuthKey = "oauth:" + Utils.GetTwitchAuthToken(e.Url.AbsoluteUri);
         }
         else
         {
             Config.BotOAuthKey = "oauth:" + Utils.GetTwitchAuthToken(e.Url.AbsoluteUri);
         }
         this.Close();
     }
 }
Beispiel #11
0
        void wb_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            var wb = sender as WebBrowserEx;

            RemoveForbiddenElements(wb);
            var model = wb.CurrentTabItem;

            //if (model != null && model.SearchBar.Address == e.Url.OriginalString)
            //{
            //    bool isValid = ValidateDNSEntrySameServer(e.Url);
            //    if(!isValid)
            //    {
            //        MessageBox.Show("Navigation canceled! IP address is different when retreived from system dll and from secure browser.", "SecureDNS", MessageBoxButton.OK, MessageBoxImage.Stop);
            //        e.Cancel = true;
            //    }
            //}
            ValidateLocalDNSEntry(e, wb);
        }
        void m_Browser_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            string url = e.Url.OriginalString;

            if (!string.IsNullOrEmpty(url))
            {
                if (url.StartsWith(HELPPROTOCOL))
                {
                    url = url.Substring(HELPPROTOCOL.Length, url.Length - HELPPROTOCOL.Length);
                    if (url.EndsWith("/"))
                    {
                        url = url.Substring(0, url.Length - 1);
                    }
                    NavigateTo(url);
                    e.Cancel = true;
                }
            }
        }
Beispiel #13
0
        void WebBrowser_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            var wb = sender as WebBrowserEx;

            if (wb != null)
            {
                var model = wb.CurrentTabItem;
                if (model != null)
                {
                    if (model.CanGoBack != model.WebBrowser.CanGoBack)
                    {
                        model.CanGoBack = model.WebBrowser.CanGoBack;
                    }
                    if (model.CanGoForward != model.WebBrowser.CanGoForward)
                    {
                        model.CanGoForward = model.WebBrowser.CanGoForward;
                    }
                }
            }
        }
Beispiel #14
0
        void webBrowserAuthorization_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            return;

            if (!initialLogoutCompleted)
            {
                return;
            }
            if (e != null)
            {
                if (e.Url.AbsoluteUri.Contains("code="))
                {
                    complete = true;

                    Model.Authentication.auth_response response = Authentications.parse_authentication_reponse(e.Url.AbsoluteUri);
                    AuthEventArgs eventArgs = new AuthEventArgs();
                    if (response.success)
                    {
                        Model.Authentication.token token = Authentications.get_access_token(response.code, client_id, client_secret, redirect_uri);
                        if (token != null)
                        {
                            eventArgs.success = true;
                            eventArgs.token   = token;
                        }
                        else
                        {
                            eventArgs.error = "Unable to retrieve access token from code";
                        }
                    }
                    else
                    {
                        eventArgs.error = response.error_message;
                    }
                    AuthSuccess(this, eventArgs);
                    Close();
                }
            }
        }
Beispiel #15
0
        private void ValidateLocalDNSEntry(System.Windows.Forms.WebBrowserNavigatingEventArgs e, WebBrowserEx wb)
        {
            string addressForChecking = string.Empty;

            if (wb.Url == null)
            {
                addressForChecking = e.Url.ToString();
            }
            if (wb.Url != null && e.Url != null &&
                wb.Url.DnsSafeHost != e.Url.DnsSafeHost)
            {
                addressForChecking = e.Url.ToString();
            }
            else if (wb.Url != null)
            {
                addressForChecking = wb.Url.ToString();
            }

            if (!string.IsNullOrEmpty(addressForChecking))
            {
                Uri uriForChecking = new Uri(addressForChecking);
                if (!checkedAddressList.Contains(uriForChecking.DnsSafeHost))
                {
                    bool isValid = ValidateDNSEntrySameServer(uriForChecking);
                    if (!isValid)
                    {
                        isValid = IsTrustedByComodo(addressForChecking);
                        if (!isValid)
                        {
                            MessageBox.Show("Navigation canceled! IP address is different when retreived from system dll and from secure browser.", "SecureDNS", MessageBoxButton.OK, MessageBoxImage.Stop);
                        }
                    }
                    checkedAddressList.Add(uriForChecking.DnsSafeHost);
                }
            }
        }
Beispiel #16
0
        void webBrowserAuthorization_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            if (complete && !initialLogoutCompleted)
            {
                return;
            }
            WebBrowser browser = sender as WebBrowser;

            if (e != null)
            {
                if (e.Url.AbsoluteUri.Contains("code="))
                {
                    complete = true;
                    e.Cancel = true;
                    Helper.Response response  = Helper.SendGetRequest(e.Url.AbsoluteUri);
                    AuthEventArgs   eventArgs = new AuthEventArgs();
                    if (!string.IsNullOrEmpty(response.Content))
                    {
                        if (!response.Content.StartsWith("ERROR:::"))
                        {
                            eventArgs.accessToken = response.Content;
                            eventArgs.success     = true;
                            AuthSuccess(this, eventArgs);
                            Close();
                            return;
                        }
                        else
                        {
                            eventArgs.error = response.Content.Substring(8);
                        }
                    }
                    else
                    {
                        eventArgs.error = "Null response";
                    }
                    AuthSuccess(this, eventArgs);
                    Close();
                }

                if (e.Url != null)
                {
                    if (e.Url.AbsoluteUri.Contains("#access_token="))
                    {
                        AuthEventArgs eventArgs = new AuthEventArgs();
                        complete = true;
                        e.Cancel = true;
                        string regexParams = "code=(.*)";
                        Regex  regex       = new Regex(regexParams);
                        Match  match       = regex.Match(e.Url.AbsoluteUri);

                        string accessToken = "";
                        if (match.Success)
                        {
                            accessToken           = match.Groups[1].Value;
                            eventArgs.success     = true;
                            eventArgs.accessToken = accessToken;
                            eventArgs.error       = "";
                        }
                        else
                        {
                            eventArgs.error = "Parsing error";
                        }

                        AuthSuccess(this, eventArgs);
                        Close();
                    }
                }
            }
        }
Beispiel #17
0
 private void _webBrowser_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
     BrowserVisible = false;
 }
Beispiel #18
0
        void b_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
        {
            string target = e.Url.AbsoluteUri;

            if (target.IndexOf("exec://") >= 0)
            {
                target = target.Replace("exec://", "");
                target = target.Replace("/", "");
            }
            if (!string.IsNullOrEmpty(target) && OnStartpageLinkClick != null)
            {
                NavigationCommandType action = NavigationCommandType.None;
                switch (target.ToLower())
                {
                case "factor_bf":
                    action = NavigationCommandType.Factor_Bf;
                    break;

                case "factor_qs":
                    action = NavigationCommandType.Factor_QS;
                    break;

                case "primetest_sieve":
                    action = NavigationCommandType.Primetest_Sieve;
                    break;

                case "primetest_miller":
                    action = NavigationCommandType.Primetest_Miller;
                    break;

                case "primesgeneration":
                    action = NavigationCommandType.Primesgeneration;
                    break;

                case "graph":
                    action = NavigationCommandType.Graph;
                    break;

                case "primedistrib_numberline":
                    action = NavigationCommandType.PrimeDistrib_Numberline;
                    break;

                case "primedistrib_numberrec":
                    action = NavigationCommandType.PrimeDistrib_Numberrec;
                    break;

                case "primedistrib_ulam":
                    action = NavigationCommandType.PrimeDistrib_Ulam;
                    break;

                case "primitivroot":
                    action = NavigationCommandType.PrimitivRoot;
                    break;

                case "powermod":
                    action = NavigationCommandType.PowerMod;
                    break;

                case "numbertheoryfunctions":
                    action = NavigationCommandType.NumberTheoryFunctions;
                    break;

                case "primedistrib_goldbach":
                    action = NavigationCommandType.PrimeDistrib_Goldbach;
                    break;
                }
                if (action != NavigationCommandType.None)
                {
                    OnStartpageLinkClick(action);
                    e.Cancel = true;
                }
            }
        }
 private void FaqBrowser_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
     throw new System.NotImplementedException();
 }
Beispiel #20
0
 private void Webbr_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
     Loading.Visibility = Visibility.Visible;
 }
Beispiel #21
0
 protected override void OnNavigating(System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
     base.OnNavigating(e);
 }
Beispiel #22
0
 private void Wb1_Navigating(object sender, System.Windows.Forms.WebBrowserNavigatingEventArgs e)
 {
 }
Beispiel #23
0
 private void OnNavigating(object sender,
                           System.Windows.Forms.WebBrowserNavigatingEventArgs arg)
 {
     //  Log.UIService.LogDebugFormat("On navigating Targetframe[{0}] : Url[{1}]", arg.TargetFrameName, arg.Url);
 }