private static void OnSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { try { InReplyToBlock textblock = (InReplyToBlock)obj; textblock.Inlines.Clear(); if (textblock.ReplyID != "0" && textblock.ReplyID != string.Empty && textblock.ReplyID != null) { InlineLink link = new InlineLink(); link.Inlines.Add(" in reply to " + textblock.ReplyTo); link.TextDecorations = null; link.ToolTip = "Load conversation"; link.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(conversationLink_Click); textblock.Inlines.Add(link); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private static void OnSourceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { try { TimeReplyToBlock textblock = (TimeReplyToBlock)obj; textblock.Inlines.Clear(); //textblock.Inlines.Add(textblock.Time + " "); InlineLink time = new InlineLink(); var tweet = (Tweet)textblock.DataContext; var uri = string.Format("http://twitter.com/{0}/status/{1}", tweet.Contact.Name.ToLower(), tweet.ID); time.Url = new Uri(uri); time.Inlines.Add(textblock.Time); time.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(link_Click); time.TextDecorations = null; time.ToolTip = "Open tweet in the default browser"; textblock.Inlines.Add(time); textblock.Inlines.Add(" "); if (!String.IsNullOrEmpty(textblock.SourceUri) && !String.IsNullOrEmpty(textblock.SourceText)) { InlineLink link = new InlineLink(); link.Url = new Uri(textblock.SourceUri); link.Inlines.Add(" from " + textblock.SourceText); link.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(link_Click); link.TextDecorations = null; link.ToolTip = "Open link in the default browser"; textblock.Inlines.Add(link); } else if (!String.IsNullOrEmpty(textblock.SourceText)) textblock.Inlines.Add(textblock.SourceText); } catch (Exception ex) { Console.WriteLine(ex.Message); } }