chatbubble封装
This commit is contained in:
@@ -59,22 +59,7 @@ namespace StormChatWPF
|
||||
App.Current.Dispatcher.Invoke(
|
||||
delegate ()
|
||||
{
|
||||
TextBlock text = new TextBlock
|
||||
{
|
||||
MaxWidth = 400,
|
||||
MinWidth = 10,
|
||||
MinHeight = 30,
|
||||
Text = message.Text,
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
FontFamily = new FontFamily("Comic Sans MS"),
|
||||
HorizontalAlignment = HorizontalAlignment.Left
|
||||
};
|
||||
Label label = new Label
|
||||
{
|
||||
HorizontalAlignment = HorizontalAlignment.Left,
|
||||
Content = text
|
||||
};
|
||||
OutBox.Children.Add(label);
|
||||
OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Left));
|
||||
});
|
||||
}//接受到的的消息
|
||||
else
|
||||
@@ -82,23 +67,7 @@ namespace StormChatWPF
|
||||
App.Current.Dispatcher.Invoke(
|
||||
delegate ()
|
||||
{
|
||||
|
||||
TextBlock text = new TextBlock
|
||||
{
|
||||
MaxWidth = 400,
|
||||
MinWidth = 10,
|
||||
MinHeight = 30,
|
||||
Text = message.Text,
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
FontFamily = new FontFamily("Comic Sans MS"),
|
||||
HorizontalAlignment = HorizontalAlignment.Right
|
||||
};
|
||||
Label label = new Label
|
||||
{
|
||||
HorizontalAlignment=HorizontalAlignment.Right,
|
||||
Content=text
|
||||
};
|
||||
OutBox.Children.Add(label);
|
||||
OutBox.Children.Add(new ChatBubble(message,HorizontalAlignment.Right));
|
||||
});
|
||||
}//发送的的消息
|
||||
}//将消息展现于UI界面
|
||||
|
||||
Reference in New Issue
Block a user