diff --git a/JianGongYun/TRTC/ViewModels/LiveWindowViewModel.cs b/JianGongYun/TRTC/ViewModels/LiveWindowViewModel.cs index 1b68427..1af180a 100644 --- a/JianGongYun/TRTC/ViewModels/LiveWindowViewModel.cs +++ b/JianGongYun/TRTC/ViewModels/LiveWindowViewModel.cs @@ -19,6 +19,7 @@ namespace JianGongYun.TRTC.ViewModels { public event PropertyChangedEventHandler PropertyChanged; + #region 直播窗口 /// /// 教室信息 /// @@ -317,6 +318,7 @@ namespace JianGongYun.TRTC.ViewModels } } } + #endregion #region 只有摄像头,则画面放大并居中 public Style MainBigWrapStyle @@ -350,5 +352,27 @@ namespace JianGongYun.TRTC.ViewModels } #endregion + #region 聊天窗口 + /// + /// 消息集合 + /// + private ObservableCollection _Chats = new ObservableCollection() { "1", "2" }; + public ObservableCollection Chats + { + set + { + _Chats = value; + if (PropertyChanged != null) + { + PropertyChanged(this, new PropertyChangedEventArgs("Chats"));//对StudentCount进行监听 + } + } + get + { + return _Chats; + } + } + #endregion + } } diff --git a/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml b/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml index 87b3795..7d7ba8c 100644 --- a/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml +++ b/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml @@ -14,7 +14,41 @@ MouseDown="Window_MouseDown" Title="" Height="600" Width="200"> + + + + + + + + + + + + @@ -24,11 +58,19 @@ 摄像头未开启 - + + + + + + + + + diff --git a/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml.cs b/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml.cs index aae8af0..c7f8ab2 100644 --- a/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml.cs +++ b/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml.cs @@ -84,5 +84,16 @@ namespace JianGongYun.TRTC.Windows } } + private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e) + { + //输入框回车 + if (e.Key == Key.Enter) + { + var text = (TextBox)sender; + //socket.send(text.Text); + LiveWindow.LiveWindowViewModel.Chats.Add(text.Text);//往Chats集合添加数据会自动更新到界面上 + text.Text = ""; + } + } } }