From 7ebfe8c2720255248a49b15d81168250bed52d9e Mon Sep 17 00:00:00 2001 From: lxmou666 <772765102@qq.com> Date: Sat, 27 Feb 2021 22:47:36 +0800 Subject: [PATCH] 123 --- JianGongYun/App.config | 17 ++++++++-------- JianGongYun/Properties/launchSettings.json | 2 +- JianGongYun/TRTC/LiveClassroom.cs | 20 ++++++++++++------- JianGongYun/TRTC/Models/ChatEntity.cs | 4 ++++ JianGongYun/TRTC/Windows/LiveWindow.xaml | 2 +- .../Windows/LiveWindowRightBottomBlock.xaml | 2 +- JianGongYun/Views/Login.xaml.cs | 5 +++-- WSDemo/Program.cs | 4 ++-- 8 files changed, 34 insertions(+), 22 deletions(-) diff --git a/JianGongYun/App.config b/JianGongYun/App.config index 70c4087..63e1132 100644 --- a/JianGongYun/App.config +++ b/JianGongYun/App.config @@ -1,11 +1,12 @@ - - - - - - - - + + + + + + + + + diff --git a/JianGongYun/Properties/launchSettings.json b/JianGongYun/Properties/launchSettings.json index dc0d16a..508b35a 100644 --- a/JianGongYun/Properties/launchSettings.json +++ b/JianGongYun/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "JianGongYun": { "commandName": "Project", - "commandLineArgs": "sznykt://--classhead|测试课程1|--classsubhead|测试章节1|--teacherid|1234_5678|--teachername|王大锤|endtime|2022-02-25 11:11:11", + "commandLineArgs": "sznykt://--classhead|测试课程1|--classsubhead|测试章节1|--teacherid|1234_1500|--teachername|王大锤|endtime|2022-02-25 11:11:11", "nativeDebugging": false } } diff --git a/JianGongYun/TRTC/LiveClassroom.cs b/JianGongYun/TRTC/LiveClassroom.cs index fd0768d..dbfbf3a 100644 --- a/JianGongYun/TRTC/LiveClassroom.cs +++ b/JianGongYun/TRTC/LiveClassroom.cs @@ -99,7 +99,8 @@ namespace JianGongYun.TRTC CurrentClassroomEntity = classroomEntity; CurrentLiveWindow = new LiveWindow(); liveWinMode = CurrentLiveWindow.DataContext as LiveWindowViewModel; - CurrentLiveWindow.Closed += CurrentLiveWindow_Closed; + CurrentLiveWindow.Closing += CurrentLiveWindow_Closed; + //CurrentLiveWindow.Closed += CurrentLiveWindow_Closed; lTRTCCloud = ITRTCCloud.getTRTCShareInstance();//创建TRTC实例 lTRTCCloud.addCallback(TRTCCloudCallback);//注册回调 @@ -777,22 +778,21 @@ namespace JianGongYun.TRTC private static void CurrentLiveWindow_Closed(object sender, EventArgs e) { - CurrentLiveWindow = null; - CurrentClassroomEntity = null; + StopMic(); + StopVideoMain(CurrentLiveWindow.AfterLiveViewWrap); + StopVideoSub(CurrentLiveWindow.AfterLiveSubViewWrap); + Heartbeat.Stop(); WSClient.Stop(System.Net.WebSockets.WebSocketCloseStatus.NormalClosure, "end"); WSClient.Dispose(); - WSClient = null; - Heartbeat = null; + lTXDeviceManager.Dispose(); - lTXDeviceManager = null; lTRTCCloud.exitRoom(); lTRTCCloud.removeCallback(TRTCCloudCallback);//注册回调 ITRTCCloud.destroyTRTCShareInstance();//销毁TRTC实例 lTRTCCloud.Dispose(); - lTRTCCloud = null; //if (CallerWindow == null) //{ // //关闭程序 @@ -800,6 +800,12 @@ namespace JianGongYun.TRTC // return; //} //CallerWindow.Close();//直接关闭 + CurrentLiveWindow = null; + CurrentClassroomEntity = null; + WSClient = null; + Heartbeat = null; + lTRTCCloud = null; + lTXDeviceManager = null; Environment.Exit(0); } diff --git a/JianGongYun/TRTC/Models/ChatEntity.cs b/JianGongYun/TRTC/Models/ChatEntity.cs index 60c6fc7..e912a1a 100644 --- a/JianGongYun/TRTC/Models/ChatEntity.cs +++ b/JianGongYun/TRTC/Models/ChatEntity.cs @@ -9,5 +9,9 @@ namespace JianGongYun.TRTC.Models public string Body { get; set; } public string Nick { get; set; } public string Date { get; set; } + public string FullBody + { + get { return $"{Date} {Nick}:{Body}"; } + } } } diff --git a/JianGongYun/TRTC/Windows/LiveWindow.xaml b/JianGongYun/TRTC/Windows/LiveWindow.xaml index 0ce8c15..19dbb44 100644 --- a/JianGongYun/TRTC/Windows/LiveWindow.xaml +++ b/JianGongYun/TRTC/Windows/LiveWindow.xaml @@ -7,7 +7,7 @@ xmlns:local="clr-namespace:JianGongYun.TRTC.Windows" xmlns:live="clr-namespace:JianGongYun.TRTC" mc:Ignorable="d" - Title="建工云课堂" MinWidth="1000" MinHeight="650" + Title="三只鸟云课堂" MinWidth="1000" MinHeight="650" d:DesignHeight="1200" d:DesignWidth="1600" BorderThickness="0" WindowStyle="None" WindowStartupLocation="CenterOwner" diff --git a/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml b/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml index 519bfe6..3aebdbc 100644 --- a/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml +++ b/JianGongYun/TRTC/Windows/LiveWindowRightBottomBlock.xaml @@ -113,7 +113,7 @@ - + diff --git a/JianGongYun/Views/Login.xaml.cs b/JianGongYun/Views/Login.xaml.cs index 8c8f100..6f910fb 100644 --- a/JianGongYun/Views/Login.xaml.cs +++ b/JianGongYun/Views/Login.xaml.cs @@ -28,6 +28,7 @@ namespace JianGongYun.Views const string TEACHER_ID = "--teacherid"; const string TEACHER_NAME = "--teachername"; const string END_TIME = "endtime"; + static string ParamTip { get { return ConfigurationManager.AppSettings[nameof(ParamTip)]; } } public Login() { InitializeComponent(); @@ -40,13 +41,13 @@ namespace JianGongYun.Views var urltemps = Environment.GetCommandLineArgs(); if (urltemps.Length < 2) { - errMsg = $"Startup Parameter Null"; + errMsg = ParamTip; goto Skip; } var first = urltemps[1]; if (!first.StartsWith("sznykt")) { - errMsg = "Startup Parameter Error"; + errMsg = ParamTip; goto Skip; } diff --git a/WSDemo/Program.cs b/WSDemo/Program.cs index 827db0b..2868c14 100644 --- a/WSDemo/Program.cs +++ b/WSDemo/Program.cs @@ -21,12 +21,12 @@ namespace WSDemo client.MessageReceived.Subscribe(msg => Console.WriteLine($"Message received: {msg}")); client.StartOrFail(); - Task.Run(() => client.Send("{code:10000,nick:\"张三\",\"room\":\"push_5678\"}")); + Task.Run(() => client.Send("{code:10000,nick:\"张三\",\"room\":\"push_1500\"}")); Task.Run(() => { while (true) { - client.Send($"{{\"code\":10086,\"mess\":\"{Guid.NewGuid()}\",\"room\":\"push_5678\"}}"); + client.Send($"{{\"code\":10086,\"mess\":\"{Guid.NewGuid()}\",\"room\":\"push_1500\"}}"); client.Send("{code:10016}"); Thread.Sleep(5000); }