예제 #1
0
        private void ReqHandler_OnBeforeBrowseEvent(object sender, Browser.EventArgs.OnBeforeBrowseEventArgs e)
        {
            if (e.Request.Url.Equals("http://tmp/", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }
            else if (e.Request.Url.StartsWith("navigate://", StringComparison.OrdinalIgnoreCase))
            {
                var r  = new Regex(@"^navigate://(?<to>.+)$");
                var to = r.Match(e.Request.Url)?.Groups["to"].Value;
                if (!string.IsNullOrWhiteSpace(to))
                {
                    switch (to.ToLower())
                    {
                    case "restore-default-value":
                        PART_PropertyGrid.Dispatcher.Invoke(new Action(() => {
                            var defaultAttr = _summaryBrowserSelectedProp?.PropertyDescriptor.Attributes.OfType <DefaultValueAttribute>().FirstOrDefault();
                            if (defaultAttr != null)
                            {
                                _summaryBrowserSelectedProp.Value = defaultAttr.Value;
                            }
                        }));

                        break;
                    }
                }

                e.CancelNavigation = true;
                return;
            }

            e.CancelNavigation = true;
            Process.Start(e.Request.Url);
        }
예제 #2
0
        private void ReqHandler_OnBeforeBrowseEvent(object sender, Browser.EventArgs.OnBeforeBrowseEventArgs e)
        {
            if (e.Request.Url.Equals("http://tmp/", StringComparison.OrdinalIgnoreCase))
            {
                return;
            }
            else if (e.Request.Url.StartsWith("navigate://", StringComparison.OrdinalIgnoreCase))
            {
                var r  = new Regex(@"^navigate://(?<to>.+)$");
                var to = r.Match(e.Request.Url)?.Groups["to"].Value;
                if (!string.IsNullOrWhiteSpace(to))
                {
                    switch (to.ToLower())
                    {
                    case "configuration":
                        Workspace.Instance.Configuration.IsActive = true;
                        break;
                    }
                }

                e.CancelNavigation = true;
                return;
            }

            e.CancelNavigation = true;
            Process.Start(e.Request.Url);
        }