public bool OnFilterNavigation(NavigationRequest request)
        {
            var pattern = @"component=([\w]+)";
            var subject = request.Url.Query;
            var match   = Regex.Match(subject, pattern);

            //ignore bad matches
            if (match.Groups.Count == 2)
            {
                VsComponent component;
                if (Enum.TryParse(match.Groups[1].Value, out component) != true ||
                    NavigationRequested == null)
                {
                    return(false);
                }

                var url  = Regex.Replace(request.Url.ToString(), pattern, "");
                var args = new ResourceInterceptorEventArgs()
                {
                    Component = component,
                    Url       = url
                };
                NavigationRequested(this, args);
                return(true);
            }
            return(false);
        }
Пример #2
0
        public bool OnFilterNavigation(NavigationRequest request)
        {
            string pattern = @"component=([\w]+)";
            string subject = request.Url.Query;
            Match  match   = Regex.Match(subject, pattern);

            //ignore bad matches
            if (match.Groups.Count == 2)
            {
                OsbideVsComponent component = OsbideVsComponent.None;
                if (Enum.TryParse(match.Groups[1].Value, out component) == true)
                {
                    if (NavigationRequested != null)
                    {
                        string url = Regex.Replace(request.Url.ToString(), pattern, "");
                        ResourceInterceptorEventArgs args = new ResourceInterceptorEventArgs()
                        {
                            Component = component,
                            Url       = url
                        };
                        NavigationRequested(this, args);
                        return(true);
                    }
                }
            }
            return(false);
        }