private void githubGUILink_ChildChanged(object sender, EventArgs e)
 {
     Windows.UI.Xaml.Controls.HyperlinkButton button = (sender as WindowsXamlHost).Child as Windows.UI.Xaml.Controls.HyperlinkButton;
     if (button != null)
     {
         button.Content     = "GUI";
         button.NavigateUri = new Uri("https://github.com/RF103T/MIUIPlusWindowSizeChanger");
     }
 }
        private Block Parse(string source)
        {
            const string UrlRegex = @"(http|https)://([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?";
            var urls = Regex.Matches(source, UrlRegex);

            var block = new Paragraph();
            int lastBlockEnd = -1;

            foreach (var match in urls.Cast<Match>())
            {
                if (match.Index > lastBlockEnd)
                {
                    block.Inlines.Add(new Run
                    {
                        Text = source.Substring(lastBlockEnd + 1, match.Index - (lastBlockEnd + 1))
                    });
                }

                if (Uri.IsWellFormedUriString(match.Value, UriKind.Absolute))
                {
                    var uri = new Uri(match.Value);

                    // In theory this should be done with Windows.UI.Xaml.Documents.Hyperlink,
                    // but in practice that class doesn't seem to exist outside of the documentation.
                    // This is a hopefully temporary hack until MS fixes that.
                    var button = new Windows.UI.Xaml.Controls.HyperlinkButton
                    {
                        NavigateUri = uri,
                        Content = new Windows.UI.Xaml.Controls.TextBlock 
                        {
                            Text = match.Value,
                            TextWrapping = TextWrapping.Wrap
                        },
                        Style = Frontend.Resources["ConversationHyperlink"] as Style
                    };

                    block.Inlines.Add(new InlineUIContainer
                    {
                        Child = button                        
                    });
                }
                else
                {
                    block.Inlines.Add(new Run
                    {
                        Text = source.Substring(match.Index, match.Length)
                    });
                }

                lastBlockEnd = match.Index + match.Length;
            }

            if (lastBlockEnd < source.Length - 1)
            {
                block.Inlines.Add(new Run
                {
                    Text = source.Substring(lastBlockEnd + 1)
                });
            }

            return block;
        }
        private Block Parse(string source)
        {
            const string UrlRegex = @"(http|https)://([\w+?\.\w+])+([a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?";
            var          urls     = Regex.Matches(source, UrlRegex);

            var block        = new Paragraph();
            int lastBlockEnd = -1;

            foreach (var match in urls.Cast <Match>())
            {
                if (match.Index > lastBlockEnd)
                {
                    block.Inlines.Add(new Run
                    {
                        Text = source.Substring(lastBlockEnd + 1, match.Index - (lastBlockEnd + 1))
                    });
                }

                if (Uri.IsWellFormedUriString(match.Value, UriKind.Absolute))
                {
                    var uri = new Uri(match.Value);

                    // In theory this should be done with Windows.UI.Xaml.Documents.Hyperlink,
                    // but in practice that class doesn't seem to exist outside of the documentation.
                    // This is a hopefully temporary hack until MS fixes that.
                    var button = new Windows.UI.Xaml.Controls.HyperlinkButton
                    {
                        NavigateUri = uri,
                        Content     = new Windows.UI.Xaml.Controls.TextBlock
                        {
                            Text         = match.Value,
                            TextWrapping = TextWrapping.Wrap
                        },
                        Style = Frontend.Resources["ConversationHyperlink"] as Style
                    };

                    block.Inlines.Add(new InlineUIContainer
                    {
                        Child = button
                    });
                }
                else
                {
                    block.Inlines.Add(new Run
                    {
                        Text = source.Substring(match.Index, match.Length)
                    });
                }

                lastBlockEnd = match.Index + match.Length;
            }

            if (lastBlockEnd < source.Length - 1)
            {
                block.Inlines.Add(new Run
                {
                    Text = source.Substring(lastBlockEnd + 1)
                });
            }

            return(block);
        }