public void OnPrepareNavigation(object sender, NavigationEventArgs args) { ArgumentUtility.CheckNotNull ("args", args); ArgumentUtility.CheckNotNull ("sender", sender); if (args.Url.ToString() == "about:blank") return; WindowPreparations preparations; var isRegistered = _registeredPreparations.TryGetValue (args.TargetName, out preparations); args.Handled = isRegistered; if (!isRegistered) return; args.BrowserWindowTarget = preparations.Type; args.StartMode = preparations.StartMode; _registeredPreparations.Remove (args.TargetName); }
private void OnBeforeNavigate(object sender, NavigationEventArgs e) { ChangeState (_states[Tuple.Create (e.AddressType, Type)]); }
private void OnBeforeNavigate(object sender, NavigationEventArgs e) { if (PrepareNavigation != null) PrepareNavigation (this, e); if (_preparations == null || !_preparations.Url.Equals (e.Url)) return; if (_preparations is FullWindowPreparations) { var preparations = (FullWindowPreparations) _preparations; Dispatch (preparations.Browser, preparations.Target, preparations.StartMode, string.Empty, e.AddressType); } else Dispatch (_preparations.Browser, e.BrowserWindowTarget, e.StartMode, e.TargetName, e.AddressType); _preparations = null; }
public void OnBeforeNavigate (NavigationEventArgs navigationEventArgs) { ArgumentUtility.CheckNotNull ("navigationEventArgs", navigationEventArgs); if (navigationEventArgs.Url.ToString() == c_blankSite) return; CurrentAddressType = navigationEventArgs.AddressType; _allowCalls = _applicationUrlFiler.IsAllowed (navigationEventArgs.Url); if (_allowCalls) ObjectForScripting = new ApiFacade (_documentHandleRegistry); if (BeforeNavigate != null) BeforeNavigate (this, navigationEventArgs); }
public override void BeforeNavigate2( object pDisp, ref object URL, ref object Flags, ref object TargetFrameName, ref object PostData, ref object Headers, ref bool Cancel) { if (URL.ToString().StartsWith ("about:blank")) return; Uri uri; if (!Uri.TryCreate (URL.ToString(), UriKind.RelativeOrAbsolute, out uri)) { Cancel = true; return; } var targetIsApplication = _applicationUrlFiler.IsAllowed (uri); var targetIsExternal = _nonApplicationUrlFilter.IsAllowed (uri); var targetIsEntryPoint = _entryPointFilter.IsAllowed (uri); var targetAddressType = targetIsApplication ? TargetAddressType.Application : TargetAddressType.NonApplication; if ((_isExternal && targetIsEntryPoint) || (!_isExternal && targetIsApplication) || targetIsExternal) { var target = String.Empty; if (TargetFrameName != null) target = TargetFrameName.ToString(); var eventArgs = new NavigationEventArgs (BrowserWindowStartMode.Active, Cancel, uri, target, BrowserWindowTarget.Tab, targetAddressType); _browserControl.OnBeforeNavigate (eventArgs); Cancel = eventArgs.Cancel; _isExternal = !targetIsApplication; } if (targetIsExternal || targetIsApplication || targetIsEntryPoint) return; if (uri.Scheme != Uri.UriSchemeFile) Process.Start (uri.ToString()); Cancel = true; }