WeiranZhang.Metropaper.Controls.NewHtmlBlock.OnNavigationRequested C# (CSharp) Method

OnNavigationRequested() public method

public OnNavigationRequested ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        public void OnNavigationRequested(object sender, RoutedEventArgs e)
        {
            if (navigationEvent != null)
            {
                Hyperlink link = e.OriginalSource as Hyperlink;

                if (link != null && link.CommandParameter != null)
                {
                    Uri uri;

                    if (link.CommandParameter.GetType() == typeof(Uri))
                    {
                        uri = link.CommandParameter as Uri;
                    }
                    else
                    {
                        uri = new Uri(link.CommandParameter.ToString());
                    }

                    navigationEvent(this, new NavigationEventArgs(link, uri));
                }
            }
        }