コード例 #1
0
        /// <summary>
        /// A hyperlink has been clicked. Start a web browser and let it browse to where this points to...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void CopyHyperlinkUri(object sender, ExecutedRoutedEventArgs e)
        {
            if (sender == null || e == null)
            {
                return;
            }

            e.Handled = true;

            WebHyperlink whLink = sender as WebHyperlink;

            if (whLink == null)
            {
                return;
            }

            try
            {
                System.Windows.Clipboard.SetText(whLink.NavigateUri.AbsoluteUri);
            }
            catch
            {
                System.Windows.Clipboard.SetText(whLink.NavigateUri.OriginalString);
            }
        }
コード例 #2
0
        /// <summary>
        /// Process command when a hyperlink has been clicked.
        /// Start a web browser and let it browse to where this points to...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void Hyperlink_CommandNavigateTo(object sender, ExecutedRoutedEventArgs e)
        {
            if (sender == null || e == null)
            {
                return;
            }

            e.Handled = true;

            WebHyperlink whLink = sender as WebHyperlink;

            if (whLink == null)
            {
                return;
            }

            try
            {
                Process.Start(new ProcessStartInfo(whLink.NavigateUri.AbsoluteUri));
            }
            catch (System.Exception ex)
            {
                var msgBox = ServiceLocator.Current.GetInstance <IMessageBoxService>();
                msgBox.Show(string.Format(CultureInfo.CurrentCulture, "{0}.", ex.Message),
                            Local.Strings.STR_MSG_ERROR_FINDING_RESOURCE,
                            MsgBoxButtons.OK, MsgBoxImage.Error);
            }
        }
コード例 #3
0
        /// <summary>
        /// Process command when a hyperlink has been clicked.
        /// Start a web browser and let it browse to where this points to...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void Hyperlink_CommandNavigateTo(object sender, ExecutedRoutedEventArgs e)
        {
            if (sender == null || e == null)
            {
                return;
            }

            e.Handled = true;

            WebHyperlink whLink = sender as WebHyperlink;

            if (whLink == null)
            {
                return;
            }

            try
            {
                Process.Start(new ProcessStartInfo(whLink.NavigateUri.AbsoluteUri));
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(string.Format(CultureInfo.CurrentCulture, "{0}.", ex.Message), "Error finding requested resource", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #4
0
        /// <summary>
        /// Process command when a hyperlink has been clicked.
        /// Start a web browser and let it browse to where this points to...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private static void Hyperlink_CommandNavigateTo(object sender, ExecutedRoutedEventArgs e)
        {
            if (sender == null || e == null)
            {
                return;
            }

            e.Handled = true;

            WebHyperlink whLink = sender as WebHyperlink;

            if (whLink == null)
            {
                return;
            }

            whLink.NavigateTo(whLink.NavigateUri.AbsoluteUri);
        }