コード例 #1
0
ファイル: ChatPage.xaml.cs プロジェクト: quangfox/Voip
        void DoOnNewConversationItem(RosterItem item, bool bReceived, TextMessage msg)
        {
            if (item.JID.BareJID == OurRosterItem.JID.BareJID)
            {
                /// Clear our new message flag for this roster user as long as this window is open
                item.HasNewMessages = false;

                AddInlinesForMessage(msg);



                this.TextBlockChat.Focus();


                //TextPointer myTextPointer1 = MainParagraph.ContentStart.GetPositionAtOffset(20);
                //TextPointer myTextPointer1 = MainParagraph.ContentEnd.GetPositionAtOffset(0, LogicalDirection.Backward);
                //TextPointer myTextPointer2 = MainParagraph.ContentEnd.GetPositionAtOffset(0, LogicalDirection.Backward);
                this.TextBlockChat.Selection.Select(this.TextBlockChat.ContentEnd, this.TextBlockChat.ContentEnd);

                ScrollChat.ScrollToVerticalOffset(this.TextBlockChat.ActualHeight + 100);
                //this.ListBoxConversation.UpdateLayout();
                //if (this.ListBoxConversation.Items.Count > 0)
                //   this.ListBoxConversation.ScrollIntoView(this.ListBoxConversation.Items[this.ListBoxConversation.Items.Count - 1]);
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: hmtri1011/Gomoku
        void PushMessage(string a, string from)
        {
            a = a.Replace("<br />", "\r\n"); // chuyển đổi kí tự xuống dòng
            TextBlock tb = new TextBlock()
            {
                FontWeight = FontWeights.Bold,
                Text       = from + "\t\t\t\t" + DateTime.Now.ToLongTimeString() + "\n",
            };

            TextBlock tb1 = new TextBlock()
            {
                FontWeight = FontWeights.Normal,
                Text       = a,
            };

            TextBlock tb2 = new TextBlock()
            {
                FontWeight = FontWeights.Thin,
                Text       = "...................................................................................................................\n",
            };

            OpacityAnimation(tb, false, false, 1.5);
            OpacityAnimation(tb1, false, false, 1.5);
            OpacityAnimation(tb2, false, false, 1.5);

            ViewPanel.Children.Add(tb);
            ViewPanel.Children.Add(tb1);
            ViewPanel.Children.Add(tb2);
            ScrollChat.ScrollToEnd();
        }
コード例 #3
0
ファイル: ChatPage.xaml.cs プロジェクト: quangfox/Voip
 private void ScrollRichTextBoxToBottom(object sender, EventArgs e)
 {
     ScrollChat.ScrollToVerticalOffset(this.TextBlockChat.ActualHeight + 100);
 }