Ejemplo n.º 1
0
        private void AddLinkText(string prefix, string linkText, string cmdText, RoutedEventHandler linkAction)
        {
            try
            {
                DateTime  tNow    = DateTime.Now;
                string    outtext = string.Format("{0}: {1}", tNow, prefix);
                Paragraph pAdd    = new Paragraph();
                Hyperlink pLink   = new Hyperlink(new Run(linkText));

                pAdd.Inlines.Add(new Run(outtext));
                pAdd.Padding = new Thickness(1);
                pAdd.Margin  = new Thickness(0);
                pLink.AddHandler(Hyperlink.ClickEvent, linkAction);
                pLink.CommandParameter = cmdText;
                pAdd.Inlines.Add(pLink);
                chatContent.Document.Blocks.Add(pAdd);
            }
            catch (NullReferenceException nex)
            {
                Log("Null ref exception in ChatWnd. " + nex.Message);
            }
            catch (Exception fex)
            {
                Log("Exception in ChatWnd, adding chat text. " + fex.Message);
            }
        }