private static void OnTextChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { RichTextBox text_block = d as RichTextBox; if (text_block == null) { return; } bool disableHyperlinks = BrowserNavigationService.GetDisableHyperlinks((DependencyObject)text_block); string textId = BrowserNavigationService.GetTextId((DependencyObject)text_block); bool hyperlinksForeground = BrowserNavigationService.GetHideHyperlinksForeground((DependencyObject)text_block); ((PresentationFrameworkCollection <Block>)text_block.Blocks).Clear(); Paragraph par = new Paragraph(); // ISSUE: explicit reference operation string newValue = (string)e.NewValue; if (string.IsNullOrEmpty(newValue)) { return; } foreach (string str1 in BrowserNavigationService.ParseText(BrowserNavigationService.PreprocessTextForGroupBoardMentions(newValue))) { string[] innerSplit = str1.Split('\b'); if (innerSplit.Length == 1) { BrowserNavigationService.AddRawText(text_block, par, innerSplit[0]); } else if (innerSplit.Length > 1) { if (disableHyperlinks) { BrowserNavigationService.AddRawText(text_block, par, innerSplit[1]); } else { if (innerSplit[0].Contains(BrowserNavigationService._searchFeedPrefix)) { int num = innerSplit[0].IndexOf(BrowserNavigationService._searchFeedPrefix) + BrowserNavigationService._searchFeedPrefix.Length; string str2 = innerSplit[0].Substring(num); innerSplit[0] = innerSplit[0].Substring(0, num) + WebUtility.UrlEncode(str2); } Hyperlink hyperlink = HyperlinkHelper.GenerateHyperlink(innerSplit[1], innerSplit[0], (Action <Hyperlink, string>)((h, navstr) => { EventAggregator.Current.Publish(new HyperlinkClickedEvent() { HyperlinkOwnerId = textId }); if (!string.IsNullOrEmpty(textId)) { string str = navstr; if (innerSplit.Length > 2) { str = str.Replace("https://", "vkontakte://"); } EventAggregator.Current.Publish(new PostInteractionEvent() { PostId = textId, Action = PostInteractionAction.link_click, Link = str }); } BrowserNavigationService.NavigateOnHyperlink(navstr); }), ((Control)text_block).Foreground, hyperlinksForeground ? HyperlinkState.MatchForeground : HyperlinkState.Normal); ((PresentationFrameworkCollection <Inline>)par.Inlines).Add((Inline)hyperlink); } } } ((PresentationFrameworkCollection <Block>)text_block.Blocks).Add((Block)par); }