This commit is contained in:
lxmou666 2021-02-27 22:47:36 +08:00
parent a012185146
commit 7ebfe8c272
8 changed files with 34 additions and 22 deletions

View File

@ -7,5 +7,6 @@
<add key="LIVEBizid" value="110962"/> <add key="LIVEBizid" value="110962"/>
<add key="RoomId" value ="654657754"/> <add key="RoomId" value ="654657754"/>
<add key="WSUrl" value ="wss://web.cqjgjyw.cn/websocket"/> <add key="WSUrl" value ="wss://web.cqjgjyw.cn/websocket"/>
<add key="ParamTip" value ="Startup Parameter Null"/>
</appSettings> </appSettings>
</configuration> </configuration>

View File

@ -2,7 +2,7 @@
"profiles": { "profiles": {
"JianGongYun": { "JianGongYun": {
"commandName": "Project", "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 "nativeDebugging": false
} }
} }

View File

@ -99,7 +99,8 @@ namespace JianGongYun.TRTC
CurrentClassroomEntity = classroomEntity; CurrentClassroomEntity = classroomEntity;
CurrentLiveWindow = new LiveWindow(); CurrentLiveWindow = new LiveWindow();
liveWinMode = CurrentLiveWindow.DataContext as LiveWindowViewModel; liveWinMode = CurrentLiveWindow.DataContext as LiveWindowViewModel;
CurrentLiveWindow.Closed += CurrentLiveWindow_Closed; CurrentLiveWindow.Closing += CurrentLiveWindow_Closed;
//CurrentLiveWindow.Closed += CurrentLiveWindow_Closed;
lTRTCCloud = ITRTCCloud.getTRTCShareInstance();//创建TRTC实例 lTRTCCloud = ITRTCCloud.getTRTCShareInstance();//创建TRTC实例
lTRTCCloud.addCallback(TRTCCloudCallback);//注册回调 lTRTCCloud.addCallback(TRTCCloudCallback);//注册回调
@ -777,22 +778,21 @@ namespace JianGongYun.TRTC
private static void CurrentLiveWindow_Closed(object sender, EventArgs e) private static void CurrentLiveWindow_Closed(object sender, EventArgs e)
{ {
CurrentLiveWindow = null; StopMic();
CurrentClassroomEntity = null; StopVideoMain(CurrentLiveWindow.AfterLiveViewWrap);
StopVideoSub(CurrentLiveWindow.AfterLiveSubViewWrap);
Heartbeat.Stop(); Heartbeat.Stop();
WSClient.Stop(System.Net.WebSockets.WebSocketCloseStatus.NormalClosure, "end"); WSClient.Stop(System.Net.WebSockets.WebSocketCloseStatus.NormalClosure, "end");
WSClient.Dispose(); WSClient.Dispose();
WSClient = null;
Heartbeat = null;
lTXDeviceManager.Dispose(); lTXDeviceManager.Dispose();
lTXDeviceManager = null;
lTRTCCloud.exitRoom(); lTRTCCloud.exitRoom();
lTRTCCloud.removeCallback(TRTCCloudCallback);//注册回调 lTRTCCloud.removeCallback(TRTCCloudCallback);//注册回调
ITRTCCloud.destroyTRTCShareInstance();//销毁TRTC实例 ITRTCCloud.destroyTRTCShareInstance();//销毁TRTC实例
lTRTCCloud.Dispose(); lTRTCCloud.Dispose();
lTRTCCloud = null;
//if (CallerWindow == null) //if (CallerWindow == null)
//{ //{
// //关闭程序 // //关闭程序
@ -800,6 +800,12 @@ namespace JianGongYun.TRTC
// return; // return;
//} //}
//CallerWindow.Close();//直接关闭 //CallerWindow.Close();//直接关闭
CurrentLiveWindow = null;
CurrentClassroomEntity = null;
WSClient = null;
Heartbeat = null;
lTRTCCloud = null;
lTXDeviceManager = null;
Environment.Exit(0); Environment.Exit(0);
} }

View File

@ -9,5 +9,9 @@ namespace JianGongYun.TRTC.Models
public string Body { get; set; } public string Body { get; set; }
public string Nick { get; set; } public string Nick { get; set; }
public string Date { get; set; } public string Date { get; set; }
public string FullBody
{
get { return $"{Date} {Nick}{Body}"; }
}
} }
} }

View File

@ -7,7 +7,7 @@
xmlns:local="clr-namespace:JianGongYun.TRTC.Windows" xmlns:local="clr-namespace:JianGongYun.TRTC.Windows"
xmlns:live="clr-namespace:JianGongYun.TRTC" xmlns:live="clr-namespace:JianGongYun.TRTC"
mc:Ignorable="d" mc:Ignorable="d"
Title="建工云课堂" MinWidth="1000" MinHeight="650" Title="三只鸟云课堂" MinWidth="1000" MinHeight="650"
d:DesignHeight="1200" d:DesignWidth="1600" d:DesignHeight="1200" d:DesignWidth="1600"
BorderThickness="0" WindowStyle="None" BorderThickness="0" WindowStyle="None"
WindowStartupLocation="CenterOwner" WindowStartupLocation="CenterOwner"

View File

@ -113,7 +113,7 @@
<!--自定义ListBox项样式--> <!--自定义ListBox项样式-->
<DataTemplate> <DataTemplate>
<StackPanel> <StackPanel>
<TextBlock Foreground="White" TextWrapping="Wrap" Text="{Binding Path=Body}"> <TextBlock Foreground="White" TextWrapping="Wrap" Text="{Binding Path=FullBody,Mode=OneWay}">
</TextBlock> </TextBlock>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>

View File

@ -28,6 +28,7 @@ namespace JianGongYun.Views
const string TEACHER_ID = "--teacherid"; const string TEACHER_ID = "--teacherid";
const string TEACHER_NAME = "--teachername"; const string TEACHER_NAME = "--teachername";
const string END_TIME = "endtime"; const string END_TIME = "endtime";
static string ParamTip { get { return ConfigurationManager.AppSettings[nameof(ParamTip)]; } }
public Login() public Login()
{ {
InitializeComponent(); InitializeComponent();
@ -40,13 +41,13 @@ namespace JianGongYun.Views
var urltemps = Environment.GetCommandLineArgs(); var urltemps = Environment.GetCommandLineArgs();
if (urltemps.Length < 2) if (urltemps.Length < 2)
{ {
errMsg = $"Startup Parameter Null"; errMsg = ParamTip;
goto Skip; goto Skip;
} }
var first = urltemps[1]; var first = urltemps[1];
if (!first.StartsWith("sznykt")) if (!first.StartsWith("sznykt"))
{ {
errMsg = "Startup Parameter Error"; errMsg = ParamTip;
goto Skip; goto Skip;
} }

View File

@ -21,12 +21,12 @@ namespace WSDemo
client.MessageReceived.Subscribe(msg => Console.WriteLine($"Message received: {msg}")); client.MessageReceived.Subscribe(msg => Console.WriteLine($"Message received: {msg}"));
client.StartOrFail(); client.StartOrFail();
Task.Run(() => client.Send("{code:10000,nick:\"张三\",\"room\":\"push_5678\"}")); Task.Run(() => client.Send("{code:10000,nick:\"张三\",\"room\":\"push_1500\"}"));
Task.Run(() => Task.Run(() =>
{ {
while (true) 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}"); client.Send("{code:10016}");
Thread.Sleep(5000); Thread.Sleep(5000);
} }