Compare commits

..

No commits in common. "master" and "v1" have entirely different histories.
master ... v1

51 changed files with 651 additions and 1580 deletions

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;

View File

@ -53,7 +53,7 @@ namespace JianGongYun.TRTC.Utils
public static bool IsTestEnv() public static bool IsTestEnv()
{ {
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ShowTestEnv.txt"); string path = Environment.CurrentDirectory + "\\ShowTestEnv.txt";
return File.Exists(path); return File.Exists(path);
} }

View File

@ -7,8 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JianGongYun", "JianGongYun\
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientDemo", "ClientDemo\ClientDemo.csproj", "{5C83270B-1086-494D-BCAF-0E773CC598AB}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClientDemo", "ClientDemo\ClientDemo.csproj", "{5C83270B-1086-494D-BCAF-0E773CC598AB}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSDemo", "WSDemo\WSDemo.csproj", "{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -43,18 +41,6 @@ Global
{5C83270B-1086-494D-BCAF-0E773CC598AB}.Release|x64.Build.0 = Release|Any CPU {5C83270B-1086-494D-BCAF-0E773CC598AB}.Release|x64.Build.0 = Release|Any CPU
{5C83270B-1086-494D-BCAF-0E773CC598AB}.Release|x86.ActiveCfg = Release|Any CPU {5C83270B-1086-494D-BCAF-0E773CC598AB}.Release|x86.ActiveCfg = Release|Any CPU
{5C83270B-1086-494D-BCAF-0E773CC598AB}.Release|x86.Build.0 = Release|Any CPU {5C83270B-1086-494D-BCAF-0E773CC598AB}.Release|x86.Build.0 = Release|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Debug|x64.ActiveCfg = Debug|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Debug|x64.Build.0 = Debug|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Debug|x86.ActiveCfg = Debug|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Debug|x86.Build.0 = Debug|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Release|Any CPU.Build.0 = Release|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Release|x64.ActiveCfg = Release|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Release|x64.Build.0 = Release|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Release|x86.ActiveCfg = Release|Any CPU
{A748F095-84EF-4D1B-A1B1-842ADCD73D6C}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -1,8 +0,0 @@
{
"sDKAppID": "1400472092",
"sDKAppKEY": "75907eef24093acc1d2cc20ed1eb95c50cd6728c8f5e0d98b17c5180824eee78",
"lIVEAppID": "1302772646",
"lIVEBizid": "110962",
"wSUrl": "wss://web.cqjgjyw.cn/websocket",
"paramTip": "Startup Parameter Null"
}

View File

@ -3,13 +3,16 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
d1p1:Ignorable="d" d1p1:Ignorable="d"
xmlns:local="clr-namespace:JianGongYun"
xmlns:vm="clr-namespace:JianGongYun.ViewModel"
xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"
StartupUri="/Views/Login.xaml"> StartupUri="/Views/Login.xaml">
<Application.Resources> <Application.Resources>
<ResourceDictionary> <ResourceDictionary>
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
<ResourceDictionary.MergedDictionaries> <ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/sznykt;component/Style/ShowControl.xaml"/> <ResourceDictionary Source="pack://application:,,,/JianGongYun;component/Style/ShowControl.xaml"/>
<ResourceDictionary Source="pack://application:,,,/sznykt;component/Style/TRTCResource.xaml"/> <ResourceDictionary Source="pack://application:,,,/JianGongYun;component/Style/TRTCResource.xaml"/>
</ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries>
</ResourceDictionary> </ResourceDictionary>
</Application.Resources> </Application.Resources>

View File

@ -1,11 +1,10 @@
using Newtonsoft.Json.Linq; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Configuration;
using System.Data; using System.Data;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Media.Imaging;
namespace JianGongYun namespace JianGongYun
{ {
@ -14,25 +13,5 @@ namespace JianGongYun
/// </summary> /// </summary>
public partial class App : Application public partial class App : Application
{ {
public static BitmapImage icon
{
get
{
BitmapImage bitmapImage = new BitmapImage();
string name = "JianGongYun.lg.ico";
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream stream = assembly.GetManifestResourceStream(name);
bitmapImage.BeginInit();
bitmapImage.StreamSource = stream;
bitmapImage.EndInit();
return bitmapImage;
}
}
private static JObject config = JObject.Parse(System.IO.File.ReadAllText(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App.json")));
public static T GetConfig<T>(string key)
{
return config[key].ToObject<T>();
}
} }
} }

View File

@ -10,33 +10,35 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<StartupObject></StartupObject> <StartupObject></StartupObject>
<Platforms>AnyCPU;x64;x86</Platforms> <Platforms>AnyCPU;x64;x86</Platforms>
<AssemblyName>sznykt</AssemblyName>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="lg.ico" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AduSkin" Version="1.1.1.8" /> <PackageReference Include="AduSkin" Version="1.1.1.8" />
<PackageReference Include="CommonServiceLocator" Version="2.0.5" /> <PackageReference Include="CommonServiceLocator" Version="2.0.5" />
<PackageReference Include="MvvmLightLibs" Version="5.4.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.5.1.20201229" /> <PackageReference Include="OpenCvSharp4.runtime.win" Version="4.5.1.20201229" />
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.5.1.20201229" /> <PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.5.1.20201229" />
<PackageReference Include="Websocket.Client" Version="4.3.30" /> <PackageReference Include="zlib.net" Version="1.0.4" />
<PackageReference Include="zlib.net-mutliplatform" Version="1.0.4" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net45'"> <ItemGroup Condition="'$(TargetFramework)' != 'net45'">
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" /> <PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="App.json"> <Compile Update="Views\Window2.xaml.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <SubType>Code</SubType>
</None> </Compile>
</ItemGroup>
<ItemGroup>
<None Update="logo.ico"> <None Update="logo.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Page Update="Views\Window2.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ManageLiteAV" Condition="'$(Platform)' == 'x64'"> <Reference Include="ManageLiteAV" Condition="'$(Platform)' == 'x64'">
<HintPath>TRTC_SDK\Win64\lib\ManageLiteAV.dll</HintPath> <HintPath>TRTC_SDK\Win64\lib\ManageLiteAV.dll</HintPath>
@ -53,17 +55,7 @@
<Version>4.5.1.20201229</Version> <Version>4.5.1.20201229</Version>
</PackageReference> </PackageReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="lg.ico">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="set Platform=Win64&#xD;&#xA;SETLOCAL ENABLEDELAYEDEXPANSION&#xD;&#xA;if $(PlatformName)==x86 ( &#xD;&#xA;set Platform=Win32&#xD;&#xA;)&#xD;&#xA;copy /Y &quot;$(ProjectDir)TRTC_SDK\!Platform!\lib\*.*&quot; &quot;$(ProjectDir)$(OutDir)&quot;&#xD;&#xA;ENDLOCAL" /> <Exec Command="set Platform=Win64&#xD;&#xA;SETLOCAL ENABLEDELAYEDEXPANSION&#xD;&#xA;if $(PlatformName)==x86 ( &#xD;&#xA;set Platform=Win32&#xD;&#xA;)&#xD;&#xA;copy /Y &quot;$(ProjectDir)TRTC_SDK\!Platform!\lib\*.dll&quot; &quot;$(ProjectDir)$(OutDir)&quot;&#xD;&#xA;copy /Y &quot;$(ProjectDir)TRTC_SDK\!Platform!\lib\*.exe&quot; &quot;$(ProjectDir)$(OutDir)&quot;&#xD;&#xA;ENDLOCAL" />
</Target> </Target>
<ProjectExtensions>
<VisualStudio>
<UserProperties app_1json__JsonSchema="https://beaujs.com/schema.json" />
</VisualStudio>
</ProjectExtensions>
</Project> </Project>

View File

@ -0,0 +1,38 @@
<Metro:MetroWindow
x:Class="JianGongYun.MainWindow"
xmlns:Metro="clr-namespace:AduSkin.Controls.Metro;assembly=AduSkin"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun"
mc:Ignorable="d"
Title="建工云课堂" MinWidth="600" MinHeight="350"
d:DesignHeight="1200" d:DesignWidth="1600"
BorderThickness="0" WindowStyle="None"
Background="#FFF"
DataContext="{Binding Source={StaticResource Locator},Path=Main}">
<Metro:MetroWindow.Menu>
<Metro:MetroTitleMenu Height="40">
<Metro:MetroTitleMenuItem Header="联系我们">
<Metro:MetroMenuItem Header="QQ" />
</Metro:MetroTitleMenuItem>
<Metro:MetroTitleMenuItem Header="关于">
<MenuItem Style="{StaticResource MenuItem_NonStyle}" Height="30">
<MenuItem.Header>
<Grid>
<TextBlock Text="主题色" Margin="33,0" VerticalAlignment="Center"/>
<Metro:MetroColorPicker x:Name="Theme" Width="20" Height="20" Background="{StaticResource DefaultBrush}" DefaultColor="{StaticResource DefaultBrush}" />
</Grid>
</MenuItem.Header>
</MenuItem>
</Metro:MetroTitleMenuItem>
</Metro:MetroTitleMenu>
</Metro:MetroWindow.Menu>
<Grid>
<ContentControl Content="{Binding TeachingInfo}"/>
</Grid>
</Metro:MetroWindow>

View File

@ -0,0 +1,43 @@
using AduSkin.Controls.Metro;
using AduSkin.Themes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JianGongYun
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : MetroWindow
{
public MainWindow()
{
InitializeComponent();
this.Closed += delegate { Application.Current.Shutdown(); };
Theme.ColorChange += delegate
{
// 不要通过XAML来绑定颜色无法获取到通知
BorderBrush = Theme.CurrentColor.OpaqueSolidColorBrush;
};
BorderBrush = new SolidColorBrush(color: Color.FromRgb(42, 43, 48));
//TRTC集成测试
//ManageLiteAV.ITRTCCloud lTRTCCloud = ManageLiteAV.ITRTCCloud.getTRTCShareInstance();
//MessageBox.Show(lTRTCCloud.getSDKVersion());
//ManageLiteAV.ITRTCCloud.destroyTRTCShareInstance();
}
}
}

View File

@ -2,7 +2,6 @@
"profiles": { "profiles": {
"JianGongYun": { "JianGongYun": {
"commandName": "Project", "commandName": "Project",
"commandLineArgs": "sznykt://--classhead|测试课程1|--classsubhead|测试章节1|--teacherid|1234_1500|--teachername|王大锤|endtime|2022-02-25 11:11:11",
"nativeDebugging": false "nativeDebugging": false
} }
} }

View File

@ -71,7 +71,7 @@
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/> <Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
<Setter Property="Background" Value="Transparent"/> <Setter Property="Background" Value="Transparent"/>
<Setter Property="Margin" Value="0,1,1,6"/> <Setter Property="Margin" Value="0,1,1,6"/>
<Setter Property="Width" Value="5"/> <Setter Property="Width" Value="10"/>
<Setter Property="MinWidth" Value="5"/> <Setter Property="MinWidth" Value="5"/>
<Setter Property="Opacity" Value="0.2"/> <Setter Property="Opacity" Value="0.2"/>
<Setter Property="Template"> <Setter Property="Template">

View File

@ -20,9 +20,6 @@ using System.Drawing;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using AduSkin.Controls.Metro; using AduSkin.Controls.Metro;
using Websocket.Client;
using System.Windows.Threading;
using Newtonsoft.Json.Linq;
namespace JianGongYun.TRTC namespace JianGongYun.TRTC
{ {
@ -31,16 +28,8 @@ namespace JianGongYun.TRTC
/// </summary> /// </summary>
public static class LiveClassroom public static class LiveClassroom
{ {
//const uint SDKAppID = 1400463444; const uint SDKAppID = 1400472092;
//const string SDKAppKEY = "6ee2586282eb8ab5bff3f917b44500c4ffd9bbd3d820258b1fa8cdd470cfd1ee"; const string SDKAppKEY = "75907eef24093acc1d2cc20ed1eb95c50cd6728c8f5e0d98b17c5180824eee78";
//const uint LIVEAppID = 1252883401;
//const uint LIVEBizid = 126866;
static uint SDKAppID { get { return App.GetConfig<uint>("sDKAppID"); } }
static string SDKAppKEY { get { return App.GetConfig<string>("sDKAppKEY"); } }
static uint LIVEAppID { get { return App.GetConfig<uint>("lIVEAppID"); } }
static uint LIVEBizid { get { return App.GetConfig<uint>("lIVEBizid"); } }
static string WSUrl { get { return App.GetConfig<string>("wSUrl"); } }
/// <summary> /// <summary>
/// TRTC实例 /// TRTC实例
/// </summary> /// </summary>
@ -56,18 +45,10 @@ namespace JianGongYun.TRTC
/// <summary> /// <summary>
/// 直播窗口 /// 直播窗口
/// </summary> /// </summary>
public static LiveWindow CurrentLiveWindow; public static Window CurrentLiveWindow;
public static LiveWindowViewModel liveWinMode; private static LiveWindowViewModel liveWinMode;
public static ClassroomEntity CurrentClassroomEntity { get; private set; } public static ClassroomEntity CurrentClassroomEntity { get; private set; }
public static TRTCCloudCallback TRTCCloudCallback = new TRTCCloudCallback(); public static TRTCCloudCallback TRTCCloudCallback = new TRTCCloudCallback();
/// <summary>
/// ws客户端
/// </summary>
public static WebsocketClient WSClient = null;
public static DispatcherTimer Heartbeat = null;
public static string ClassId = null;//章节id
/// <summary> /// <summary>
/// 摄像头帧 /// 摄像头帧
/// </summary> /// </summary>
@ -98,8 +79,7 @@ namespace JianGongYun.TRTC
CurrentClassroomEntity = classroomEntity; CurrentClassroomEntity = classroomEntity;
CurrentLiveWindow = new LiveWindow(); CurrentLiveWindow = new LiveWindow();
liveWinMode = CurrentLiveWindow.DataContext as LiveWindowViewModel; liveWinMode = CurrentLiveWindow.DataContext as LiveWindowViewModel;
CurrentLiveWindow.Closing += CurrentLiveWindow_Closed; CurrentLiveWindow.Closed += CurrentLiveWindow_Closed;
//CurrentLiveWindow.Closed += CurrentLiveWindow_Closed;
lTRTCCloud = ITRTCCloud.getTRTCShareInstance();//创建TRTC实例 lTRTCCloud = ITRTCCloud.getTRTCShareInstance();//创建TRTC实例
lTRTCCloud.addCallback(TRTCCloudCallback);//注册回调 lTRTCCloud.addCallback(TRTCCloudCallback);//注册回调
@ -110,9 +90,7 @@ namespace JianGongYun.TRTC
userSig = GenTestUserSig(CurrentClassroomEntity.TeacherId), userSig = GenTestUserSig(CurrentClassroomEntity.TeacherId),
roomId = 0,//使用strRoomId roomId = 0,//使用strRoomId
strRoomId = CurrentClassroomEntity.TeacherId, strRoomId = CurrentClassroomEntity.TeacherId,
role = TRTCRoleType.TRTCRoleAnchor, role = TRTCRoleType.TRTCRoleAnchor
streamId = CurrentClassroomEntity.TeacherId,//旁路CDN流名字为教师id
userDefineRecordId = CurrentClassroomEntity.TeacherId//指定id录制教师
}; };
lTRTCCloud.enterRoom(ref roomPars, TRTCAppScene.TRTCAppSceneLIVE);//创建房间 lTRTCCloud.enterRoom(ref roomPars, TRTCAppScene.TRTCAppSceneLIVE);//创建房间
@ -126,58 +104,21 @@ namespace JianGongYun.TRTC
} }
lTXDeviceManager.setCurrentDeviceVolume(TRTCDeviceType.TXMediaDeviceTypeMic, settingWindowViewModel.MicVolume);//麦克风采集音量 lTXDeviceManager.setCurrentDeviceVolume(TRTCDeviceType.TXMediaDeviceTypeMic, settingWindowViewModel.MicVolume);//麦克风采集音量
lTRTCCloud.setSystemAudioLoopbackVolume(settingWindowViewModel.SytemGatherVolume);//系统声音采集音量 lTRTCCloud.setSystemAudioLoopbackVolume(settingWindowViewModel.SytemGatherVolume);//系统声音采集音量
if (settingWindowViewModel.AudioSource == "2")
{
lTRTCCloud.startSystemAudioLoopback(null);
}
else
{
lTRTCCloud.stopSystemAudioLoopback();
}
//设备完结 //设备完结
//liveWinMode.LoadAllScreen(); //liveWinMode.LoadAllScreen();
_RecoderDir = $"{classroomEntity.ClassHead}_{classroomEntity.ClassSubHead}"; _RecoderDir = $"{classroomEntity.ClassHead}_{classroomEntity.ClassSubHead}";
//连接WS callerWindow.Hide();//隐藏调用窗口
if (WSClient != null && WSClient.IsRunning)//只连一个
{
WSClient.Stop(System.Net.WebSockets.WebSocketCloseStatus.NormalClosure, "connect repeat");
WSClient.Dispose();
}
var url = new Uri(WSUrl);
WSClient = new WebsocketClient(url);
WSClient.ErrorReconnectTimeout = TimeSpan.FromSeconds(10);
WSClient.ReconnectTimeout = TimeSpan.FromSeconds(10);
WSClient.ReconnectionHappened.Subscribe((info) =>
{
$"Reconnection happened, type: {info.Type}".ToLocalLog();
if (WSClient.IsRunning)
{
var joinRoom = $"{{code:10000,nick:\"{CurrentClassroomEntity.TeacherName}\",\"room\":\"push_{ClassId}\"}}";
WSClient.Send(joinRoom);//进房间
joinRoom.ToLocalLog();
}
liveWinMode.WSConneced = true;
});
WSClient.DisconnectionHappened.Subscribe((info) =>
{
$"DisconnectionHappened happened, type: {info.Type} {info.CloseStatusDescription} {info.Exception}".ToLocalLog();
liveWinMode.WSConneced = false;
});
WSClient.MessageReceived.Subscribe(CurrentLiveWindow.OnMsg);
WSClient.Start();
ClassId = CurrentClassroomEntity.TeacherId.Split('_')[1];
//发送心跳包
Heartbeat = new DispatcherTimer(DispatcherPriority.Render);
Heartbeat.Interval = TimeSpan.FromSeconds(5);
Heartbeat.Tick += new EventHandler((a, b) =>
{
if (WSClient.IsRunning)
{
WSClient.Send("{code:10016}");//向服务器发送心跳包
"发送心跳包 {code:10016}".ToLocalLog();
}
});
Heartbeat.Start();
callerWindow?.Hide();//隐藏调用窗口
CurrentLiveWindow.Show(); CurrentLiveWindow.Show();
} }
@ -253,7 +194,7 @@ namespace JianGongYun.TRTC
lTRTCCloud.startLocalPreview(IntPtr.Zero); lTRTCCloud.startLocalPreview(IntPtr.Zero);
liveWinMode.CameraRunning = true; liveWinMode.CameraRunning = true;
var view = AddCustomVideoView(parent, CurrentClassroomEntity.TeacherId, TRTCVideoStreamType.TRTCVideoStreamTypeBig, true); var view = AddCustomVideoView(parent, CurrentClassroomEntity.TeacherId, TRTCVideoStreamType.TRTCVideoStreamTypeBig, true);
if (liveWinMode.IsLive && settingWindowViewModel.LocalRecorder) if (liveWinMode.IsLive)
{ {
view.OnRenderVideoFrameHandler += (data, w, h) => view.OnRenderVideoFrameHandler += (data, w, h) =>
{ {
@ -304,7 +245,7 @@ namespace JianGongYun.TRTC
SelectVieoSub(); SelectVieoSub();
lTRTCCloud.startScreenCapture(IntPtr.Zero, TRTCVideoStreamType.TRTCVideoStreamTypeSub, settingWindowViewModel.SubEncParams); lTRTCCloud.startScreenCapture(IntPtr.Zero, TRTCVideoStreamType.TRTCVideoStreamTypeSub, settingWindowViewModel.SubEncParams);
var view = AddCustomVideoView(parent, CurrentClassroomEntity.TeacherId, TRTCVideoStreamType.TRTCVideoStreamTypeSub, true); var view = AddCustomVideoView(parent, CurrentClassroomEntity.TeacherId, TRTCVideoStreamType.TRTCVideoStreamTypeSub, true);
if (liveWinMode.IsLive && settingWindowViewModel.LocalRecorder) if (liveWinMode.IsLive)
{ {
view.OnRenderVideoFrameHandler += (data, w, h) => view.OnRenderVideoFrameHandler += (data, w, h) =>
{ {
@ -351,33 +292,6 @@ namespace JianGongYun.TRTC
lTRTCCloud.selectScreenCaptureTarget(ref current, ref rect, ref property); lTRTCCloud.selectScreenCaptureTarget(ref current, ref rect, ref property);
} }
//开启音频后调用
public static void StartMUX(bool stop = false)
{
if (stop)
{
lTRTCCloud.setMixTranscodingConfig(null);
return;
}
var resolution = settingWindowViewModel.SubEncParams.videoResolution.ToString().Split('_');//屏幕分辨率,本地储存分辨率以屏幕分享分辨率为基准
lTRTCCloud.setMixTranscodingConfig(new TRTCTranscodingConfig //设置混流
{
mode = TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Template_ScreenSharing,
appId = LIVEAppID,
bizId = LIVEBizid,
videoWidth = uint.Parse(resolution[1]),
videoHeight = uint.Parse(resolution[2]),
videoBitrate = settingWindowViewModel.SubEncParams.videoBitrate,
videoFramerate = settingWindowViewModel.SubEncParams.videoFps,
videoGOP = 3,
backgroundColor = 0x202020,
audioSampleRate = 48000,
audioBitrate = 128,
audioChannels = 2
});
}
/// <summary> /// <summary>
/// 启动麦克风 /// 启动麦克风
/// </summary> /// </summary>
@ -387,13 +301,8 @@ namespace JianGongYun.TRTC
{ {
liveWinMode.MicRunning = true; liveWinMode.MicRunning = true;
lTRTCCloud.startLocalAudio(settingWindowViewModel.LiveAudioLevel); lTRTCCloud.startLocalAudio(settingWindowViewModel.LiveAudioLevel);
if (settingWindowViewModel.LocalRecorder)
{
StartRecordAudio(); StartRecordAudio();
} }
StartMUX();
}
} }
/// <summary> /// <summary>
@ -416,33 +325,6 @@ namespace JianGongYun.TRTC
lTRTCCloud.stopAudioRecording(); lTRTCCloud.stopAudioRecording();
} }
} }
public static void EnableAudio()
{
if (settingWindowViewModel.AudioSource == "1")
{
//lTRTCCloud.muteLocalAudio(false);
lTXDeviceManager.setCurrentDeviceVolume(ManageLiteAV.TRTCDeviceType.TXMediaDeviceTypeMic, settingWindowViewModel.MicVolume);
lTRTCCloud.stopSystemAudioLoopback();
liveWinMode.MicMute = false;
liveWinMode.SysMute = true;
}
else if (settingWindowViewModel.AudioSource == "2")
{
//lTRTCCloud.muteLocalAudio(true);
lTXDeviceManager.setCurrentDeviceVolume(ManageLiteAV.TRTCDeviceType.TXMediaDeviceTypeMic, 0);
lTRTCCloud.startSystemAudioLoopback(null);
liveWinMode.MicMute = true;
liveWinMode.SysMute = false;
}
else if (settingWindowViewModel.AudioSource == "3")
{
//lTRTCCloud.muteLocalAudio(false);
lTXDeviceManager.setCurrentDeviceVolume(ManageLiteAV.TRTCDeviceType.TXMediaDeviceTypeMic, settingWindowViewModel.MicVolume);
lTRTCCloud.startSystemAudioLoopback(null);
liveWinMode.MicMute = false;
liveWinMode.SysMute = false;
}
}
/// <summary> /// <summary>
/// 关闭麦克风 /// 关闭麦克风
/// </summary> /// </summary>
@ -451,49 +333,19 @@ namespace JianGongYun.TRTC
if (liveWinMode.MicRunning) if (liveWinMode.MicRunning)
{ {
liveWinMode.MicRunning = false; liveWinMode.MicRunning = false;
if (settingWindowViewModel.LocalRecorder)
{
StopRecordAudio(); StopRecordAudio();
}
lTRTCCloud.stopLocalAudio(); lTRTCCloud.stopLocalAudio();
} }
} }
/// <summary> /// <summary>
/// 设置麦克风静音 /// 设置麦克风静音
/// </summary> /// </summary>
public static void SetMicMute(bool? mute = true, string tag = "mic") public static void SetMicMute(bool? mute = true)
{ {
if (liveWinMode.MicRunning) if (liveWinMode.MicRunning)
{
if (tag == "mic")
{ {
liveWinMode.MicMute = mute.HasValue ? mute.Value : !liveWinMode.MicMute; liveWinMode.MicMute = mute.HasValue ? mute.Value : !liveWinMode.MicMute;
if (liveWinMode.MicMute) lTRTCCloud.muteLocalAudio(liveWinMode.MicMute);
{
//lTRTCCloud.muteLocalAudio(true);
lTXDeviceManager.setCurrentDeviceVolume(ManageLiteAV.TRTCDeviceType.TXMediaDeviceTypeMic, 0);
}
else
{
//EnableAudio();
lTXDeviceManager.setCurrentDeviceVolume(ManageLiteAV.TRTCDeviceType.TXMediaDeviceTypeMic, settingWindowViewModel.MicVolume);
}
}
else
{
liveWinMode.SysMute = mute.HasValue ? mute.Value : !liveWinMode.SysMute;
if (liveWinMode.SysMute)
{
lTRTCCloud.stopSystemAudioLoopback();
}
else
{
lTRTCCloud.startSystemAudioLoopback(null);
}
}
//lTRTCCloud.muteLocalAudio(liveWinMode.MicMute);
} }
} }
@ -696,7 +548,7 @@ namespace JianGongYun.TRTC
vw.Dispose(); vw.Dispose();
//合并视频 //合并视频
var arguments = $@"-i ""{VideoTempPath}"" -i ""{AudioTempPath}"" -c:v copy -c:a copy -strict experimental -y ""{ResultFilePath}"""; var arguments = $@"-i ""{VideoTempPath}"" -i ""{AudioTempPath}"" -c:v copy -c:a copy -strict experimental -y ""{ResultFilePath}""";
Process prc = new Process { StartInfo = new ProcessStartInfo { FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ffmpeg.exe"), Arguments = arguments, CreateNoWindow = true, UseShellExecute = false } }; Process prc = new Process { StartInfo = new ProcessStartInfo { FileName = Path.Combine(Environment.CurrentDirectory, "ffmpeg.exe"), Arguments = arguments, CreateNoWindow = true, UseShellExecute = false } };
prc.Start(); prc.Start();
prc.WaitForExit(); prc.WaitForExit();
CurrentLiveWindow.Dispatcher.Invoke(new Action(() => CurrentLiveWindow.Dispatcher.Invoke(new Action(() =>
@ -728,7 +580,6 @@ namespace JianGongYun.TRTC
File.Delete(AudioTempPath); File.Delete(AudioTempPath);
} }
} }
CurrentLiveWindow.Close();
})); }));
Debug.Print("结束写入视频线程"); Debug.Print("结束写入视频线程");
}, TaskCreationOptions.LongRunning); }, TaskCreationOptions.LongRunning);
@ -819,36 +670,17 @@ namespace JianGongYun.TRTC
private static void CurrentLiveWindow_Closed(object sender, EventArgs e) private static void CurrentLiveWindow_Closed(object sender, EventArgs e)
{ {
StopMic(); CurrentLiveWindow = null;
StopVideoMain(CurrentLiveWindow.AfterLiveViewWrap); CurrentClassroomEntity = null;
StopVideoSub(CurrentLiveWindow.AfterLiveSubViewWrap); CallerWindow.Show();//还原调用者窗口
Heartbeat.Stop();
WSClient.Stop(System.Net.WebSockets.WebSocketCloseStatus.NormalClosure, "end");
WSClient.Dispose();
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();
//if (CallerWindow == null)
//{
// //关闭程序
// Environment.Exit(0);
// return;
//}
//CallerWindow.Close();//直接关闭
CurrentLiveWindow = null;
CurrentClassroomEntity = null;
WSClient = null;
Heartbeat = null;
lTRTCCloud = null; lTRTCCloud = null;
lTXDeviceManager = null;
Environment.Exit(0);
} }

View File

@ -1,17 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace JianGongYun.TRTC.Models
{
public class ChatEntity
{
public string Body { get; set; }
public string Nick { get; set; }
public string Date { get; set; }
public string FullBody
{
get { return $"{Date} {Nick}{Body}"; }
}
}
}

View File

@ -25,10 +25,6 @@ namespace JianGongYun.TRTC.Models
/// 章节名称 /// 章节名称
/// </summary> /// </summary>
public string ClassSubHead { get; set; } public string ClassSubHead { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime? EndTime { get; set; }
} }
} }

View File

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;
namespace JianGongYun.TRTC
{
public class ChatItemBgConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null ? new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)) : parameter;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}

View File

@ -1,11 +1,11 @@
using ComponentAce.Compression.Libs.zlib; using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
using zlib;
namespace JianGongYun.TRTC.Utils namespace JianGongYun.TRTC.Utils
{ {

View File

@ -1,5 +1,4 @@
using AduSkin.Controls.Metro; using ManageLiteAV;
using ManageLiteAV;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -11,96 +10,82 @@ namespace JianGongYun.TRTC.Utils
{ {
public void onAudioDeviceCaptureVolumeChanged(uint volume, bool muted) public void onAudioDeviceCaptureVolumeChanged(uint volume, bool muted)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onAudioDevicePlayoutVolumeChanged(uint volume, bool muted) public void onAudioDevicePlayoutVolumeChanged(uint volume, bool muted)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onAudioEffectFinished(int effectId, int code) public void onAudioEffectFinished(int effectId, int code)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onCameraDidReady() public void onCameraDidReady()
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onConnectionLost() public void onConnectionLost()
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
LiveClassroom.liveWinMode.TRTCConneced = false;
} }
public void onConnectionRecovery() public void onConnectionRecovery()
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
LiveClassroom.liveWinMode.TRTCConneced = true;
} }
public void onConnectOtherRoom(string userId, TXLiteAVError errCode, string errMsg) public void onConnectOtherRoom(string userId, TXLiteAVError errCode, string errMsg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onDeviceChange(string deviceId, TRTCDeviceType type, TRTCDeviceState state) public void onDeviceChange(string deviceId, TRTCDeviceType type, TRTCDeviceState state)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onDisconnectOtherRoom(TXLiteAVError errCode, string errMsg) public void onDisconnectOtherRoom(TXLiteAVError errCode, string errMsg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onEnterRoom(int result) public void onEnterRoom(int result)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
if (result > 0)
{
LiveClassroom.liveWinMode.TRTCConneced = true;
}
} }
public void onError(TXLiteAVError errCode, string errMsg, IntPtr arg) public void onError(TXLiteAVError errCode, string errMsg, IntPtr arg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name + " " + errCode + " " + errMsg); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
if (errCode == TXLiteAVError.ERR_ROOM_REQUEST_ENTER_ROOM_TIMEOUT)
{
LiveClassroom.CurrentLiveWindow.Dispatcher.Invoke(new Action(() =>
{
AduMessageBox.ShowOK("进入教室超时,请检查网络连接是否正常!", "提醒", "确定");
Environment.Exit(0);
}));
}
} }
public void onExitRoom(int reason) public void onExitRoom(int reason)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onFirstAudioFrame(string userId) public void onFirstAudioFrame(string userId)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onFirstVideoFrame(string userId, TRTCVideoStreamType streamType, int width, int height) public void onFirstVideoFrame(string userId, TRTCVideoStreamType streamType, int width, int height)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onMicDidReady() public void onMicDidReady()
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onMissCustomCmdMsg(string userId, int cmdId, int errCode, int missed) public void onMissCustomCmdMsg(string userId, int cmdId, int errCode, int missed)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onNetworkQuality(TRTCQualityInfo localQuality, TRTCQualityInfo[] remoteQuality, uint remoteQualityCount) public void onNetworkQuality(TRTCQualityInfo localQuality, TRTCQualityInfo[] remoteQuality, uint remoteQualityCount)
@ -110,92 +95,92 @@ namespace JianGongYun.TRTC.Utils
public void onPlayBGMBegin(TXLiteAVError errCode) public void onPlayBGMBegin(TXLiteAVError errCode)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onPlayBGMComplete(TXLiteAVError errCode) public void onPlayBGMComplete(TXLiteAVError errCode)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onPlayBGMProgress(uint progressMS, uint durationMS) public void onPlayBGMProgress(uint progressMS, uint durationMS)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onRecvCustomCmdMsg(string userId, int cmdID, uint seq, byte[] msg, uint msgSize) public void onRecvCustomCmdMsg(string userId, int cmdID, uint seq, byte[] msg, uint msgSize)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onRecvSEIMsg(string userId, byte[] message, uint msgSize) public void onRecvSEIMsg(string userId, byte[] message, uint msgSize)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onRemoteUserEnterRoom(string userId) public void onRemoteUserEnterRoom(string userId)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onRemoteUserLeaveRoom(string userId, int reason) public void onRemoteUserLeaveRoom(string userId, int reason)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onScreenCaptureCovered() public void onScreenCaptureCovered()
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onScreenCapturePaused(int reason) public void onScreenCapturePaused(int reason)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onScreenCaptureResumed(int reason) public void onScreenCaptureResumed(int reason)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onScreenCaptureStarted() public void onScreenCaptureStarted()
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onScreenCaptureStoped(int reason) public void onScreenCaptureStoped(int reason)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onSendFirstLocalAudioFrame() public void onSendFirstLocalAudioFrame()
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onSendFirstLocalVideoFrame(TRTCVideoStreamType streamType) public void onSendFirstLocalVideoFrame(TRTCVideoStreamType streamType)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onSetMixTranscodingConfig(int errCode, string errMsg) public void onSetMixTranscodingConfig(int errCode, string errMsg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onSpeedTest(TRTCSpeedTestResult currentResult, uint finishedCount, uint totalCount) public void onSpeedTest(TRTCSpeedTestResult currentResult, uint finishedCount, uint totalCount)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onStartPublishCDNStream(int errCode, string errMsg) public void onStartPublishCDNStream(int errCode, string errMsg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onStartPublishing(int errCode, string errMsg) public void onStartPublishing(int errCode, string errMsg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onStatistics(TRTCStatistics statis) public void onStatistics(TRTCStatistics statis)
@ -205,72 +190,72 @@ namespace JianGongYun.TRTC.Utils
public void onStopPublishCDNStream(int errCode, string errMsg) public void onStopPublishCDNStream(int errCode, string errMsg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onStopPublishing(int errCode, string errMsg) public void onStopPublishing(int errCode, string errMsg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onSwitchRole(TXLiteAVError errCode, string errMsg) public void onSwitchRole(TXLiteAVError errCode, string errMsg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onSwitchRoom(TXLiteAVError errCode, string errMsg) public void onSwitchRoom(TXLiteAVError errCode, string errMsg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onTestMicVolume(uint volume) public void onTestMicVolume(uint volume)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onTestSpeakerVolume(uint volume) public void onTestSpeakerVolume(uint volume)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onTryToReconnect() public void onTryToReconnect()
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onUserAudioAvailable(string userId, bool available) public void onUserAudioAvailable(string userId, bool available)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onUserEnter(string userId) public void onUserEnter(string userId)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onUserExit(string userId, int reason) public void onUserExit(string userId, int reason)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onUserSubStreamAvailable(string userId, bool available) public void onUserSubStreamAvailable(string userId, bool available)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onUserVideoAvailable(string userId, bool available) public void onUserVideoAvailable(string userId, bool available)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onUserVoiceVolume(TRTCVolumeInfo[] userVolumes, uint userVolumesCount, uint totalVolume) public void onUserVoiceVolume(TRTCVolumeInfo[] userVolumes, uint userVolumesCount, uint totalVolume)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
public void onWarning(TXLiteAVWarning warningCode, string warningMsg, IntPtr arg) public void onWarning(TXLiteAVWarning warningCode, string warningMsg, IntPtr arg)
{ {
StackTrace trace = new StackTrace(true); StackFrame frame = trace.GetFrame(1); var method = frame.GetMethod(); Console.WriteLine(method.Name); StackTrace trace = new StackTrace(true);StackFrame frame = trace.GetFrame(1);var method = frame.GetMethod();Console.WriteLine(method.Name);
} }
} }
} }

View File

@ -24,7 +24,7 @@ namespace JianGongYun.TRTC
bool? nullable = (bool?)value; bool? nullable = (bool?)value;
flag = nullable.HasValue ? nullable.Value : false; flag = nullable.HasValue ? nullable.Value : false;
} }
return (flag ? Visibility.Collapsed : Visibility.Visible); return (flag ? Visibility.Hidden : Visibility.Visible);
} }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)

View File

@ -7,8 +7,6 @@ using System.Security.Cryptography;
using System.Text; using System.Text;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Threading.Channels;
using System.Threading.Tasks;
namespace JianGongYun.TRTC.Utils namespace JianGongYun.TRTC.Utils
{ {
@ -55,7 +53,7 @@ namespace JianGongYun.TRTC.Utils
public static bool IsTestEnv() public static bool IsTestEnv()
{ {
string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ShowTestEnv.txt"); string path = Environment.CurrentDirectory + "\\ShowTestEnv.txt";
return File.Exists(path); return File.Exists(path);
} }
@ -93,53 +91,5 @@ namespace JianGongYun.TRTC.Utils
} }
public static string TimeStr() => DateTime.Now.ToString("yyyyMMddHHmmssfff"); public static string TimeStr() => DateTime.Now.ToString("yyyyMMddHHmmssfff");
private static readonly Channel<string> _logQueue = Channel.CreateUnbounded<string>(new UnboundedChannelOptions()
{
SingleReader = true,
SingleWriter = false
});
static Util()
{
string log = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs");
if (!System.IO.Directory.Exists(log))
{
Directory.CreateDirectory(log);
}
log = Path.Combine(log, $"{DateTime.Now.ToString("yyyyMMddHHmmssfff")}.log");
Task.Factory.StartNew(async () =>
{
try
{
while (await _logQueue.Reader.WaitToReadAsync())
{
while (_logQueue.Reader.TryRead(out var message))
{
try
{
await System.IO.File.AppendAllTextAsync(log, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}--------------------------{Environment.NewLine}{message}{Environment.NewLine}{Environment.NewLine}{Environment.NewLine}");
}
catch (Exception e)
{
e.Message.ToLocalLog();
}
}
}
}
catch (Exception ex)
{
ex.Message.ToLocalLog();
}
}, TaskCreationOptions.LongRunning);
}
public static void ToLocalLog(this string val)
{
if (!string.IsNullOrWhiteSpace(val))
{
Console.WriteLine(val);
_logQueue.Writer.TryWrite(val);
}
}
} }
} }

View File

@ -19,7 +19,6 @@ namespace JianGongYun.TRTC.ViewModels
{ {
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
#region
/// <summary> /// <summary>
/// 教室信息 /// 教室信息
/// </summary> /// </summary>
@ -28,7 +27,7 @@ namespace JianGongYun.TRTC.ViewModels
/// <summary> /// <summary>
/// 学生总数 /// 学生总数
/// </summary> /// </summary>
private int _StudentCount = 0; private int _StudentCount = 1;
public int StudentCount public int StudentCount
{ {
set set
@ -73,44 +72,6 @@ namespace JianGongYun.TRTC.ViewModels
return _IsLive; return _IsLive;
} }
} }
/// <summary>
/// ws是否连接
/// </summary>
private bool _WSConneced = false;
public bool WSConneced
{
set
{
_WSConneced = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("WSConneced"));
}
}
get
{
return _WSConneced;
}
}
/// <summary>
/// TRTC是否连接
/// </summary>
private bool _TRTCConneced = false;
public bool TRTCConneced
{
set
{
_TRTCConneced = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("TRTCConneced"));
}
}
get
{
return _TRTCConneced;
}
}
public LiveWindowViewModel() public LiveWindowViewModel()
{ {
@ -253,7 +214,6 @@ namespace JianGongYun.TRTC.ViewModels
if (PropertyChanged != null) if (PropertyChanged != null)
{ {
PropertyChanged(this, new PropertyChangedEventArgs("MicMute")); PropertyChanged(this, new PropertyChangedEventArgs("MicMute"));
PropertyChanged(this, new PropertyChangedEventArgs("SoundTip"));
} }
} }
get get
@ -261,53 +221,6 @@ namespace JianGongYun.TRTC.ViewModels
return _MicMute; return _MicMute;
} }
} }
/// <summary>
/// 系统音静音
/// </summary>
private bool _SysMute = false;
public bool SysMute
{
set
{
_SysMute = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("SysMute"));
PropertyChanged(this, new PropertyChangedEventArgs("SoundTip"));
}
}
get
{
return _SysMute;
}
}
/// <summary>
/// 声音提示
/// </summary>
private string _SoundTip;
public string SoundTip
{
get
{
if (!SysMute && !MicMute)
{
_SoundTip = "仅开启声音";
}
else if (SysMute && !MicMute)
{
_SoundTip = "仅开启麦克风";
}
else if (!SysMute && MicMute)
{
_SoundTip = "仅开启系统音";
}
else
{
_SoundTip = "所有设备被关闭";
}
return _SoundTip;
}
}
private ObservableCollection<TRTCScreenEntity> _LiveScreens = new ObservableCollection<TRTCScreenEntity>(); private ObservableCollection<TRTCScreenEntity> _LiveScreens = new ObservableCollection<TRTCScreenEntity>();
@ -404,7 +317,6 @@ namespace JianGongYun.TRTC.ViewModels
} }
} }
} }
#endregion
#region #region
public Style MainBigWrapStyle public Style MainBigWrapStyle
@ -438,27 +350,5 @@ namespace JianGongYun.TRTC.ViewModels
} }
#endregion #endregion
#region
/// <summary>
/// 消息集合
/// </summary>
private ObservableCollection<ChatEntity> _Chats = new ObservableCollection<ChatEntity>();
public ObservableCollection<ChatEntity> Chats
{
set
{
_Chats = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("Chats"));
}
}
get
{
return _Chats;
}
}
#endregion
} }
} }

View File

@ -173,19 +173,12 @@ namespace JianGongYun.TRTC.ViewModels
if (_AudioSource == "1")//只采集麦克风,关闭系统音采集 if (_AudioSource == "1")//只采集麦克风,关闭系统音采集
{ {
ShowSytemGatherSlider = Visibility.Collapsed; ShowSytemGatherSlider = Visibility.Collapsed;
ShowMicSetting = Visibility.Visible; LiveClassroom.lTRTCCloud.stopSystemAudioLoopback();
//LiveClassroom.lTRTCCloud.stopSystemAudioLoopback();
} }
else if (_AudioSource == "2")//只显示系统音 else if (_AudioSource == "2")//麦和系统音,开启采集系统音
{ {
ShowSytemGatherSlider = Visibility.Visible; ShowSytemGatherSlider = Visibility.Visible;
ShowMicSetting = Visibility.Collapsed; LiveClassroom.lTRTCCloud.startSystemAudioLoopback(null);
}
else if (_AudioSource == "3")//麦和系统音,开启采集系统音
{
ShowSytemGatherSlider = Visibility.Visible;
ShowMicSetting = Visibility.Visible;
//LiveClassroom.lTRTCCloud.startSystemAudioLoopback(null);
} }
if (PropertyChanged != null) if (PropertyChanged != null)
{ {
@ -202,7 +195,7 @@ namespace JianGongYun.TRTC.ViewModels
{ {
get get
{ {
if (AudioSource == "2" || AudioSource == "3") if (AudioSource == "2")
{ {
_ShowSytemGatherSlider = Visibility.Visible; _ShowSytemGatherSlider = Visibility.Visible;
} }
@ -221,33 +214,6 @@ namespace JianGongYun.TRTC.ViewModels
} }
} }
} }
/// <summary>
/// 是否显示系统采集滑动条
/// </summary>
private Visibility _ShowMicSetting = Visibility.Collapsed;
public Visibility ShowMicSetting
{
get
{
if (AudioSource == "1" || AudioSource == "3")
{
_ShowMicSetting = Visibility.Visible;
}
else
{
_ShowMicSetting = Visibility.Collapsed;
}
return _ShowMicSetting;
}
set
{
_ShowMicSetting = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("ShowMicSetting"));
}
}
}
/// <summary> /// <summary>
/// 系统采集音量 /// 系统采集音量
@ -462,38 +428,6 @@ namespace JianGongYun.TRTC.ViewModels
// } // }
//} //}
/// <summary>
/// 本地录制
/// </summary>
private bool _LocalRecorder = false;
public bool LocalRecorder
{
get
{
var localRecorder = storage.GetValue(INI_ROOT_KEY, INI_KEY_SCREEN_LOCALRECORDER);//本地缓存
if (string.IsNullOrEmpty(localRecorder))
{
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_LOCALRECORDER, _LocalRecorder.ToString());//生成初始数据
}
else
{
_LocalRecorder = bool.Parse(localRecorder);
}
return _LocalRecorder;
}
set
{
_LocalRecorder = value;
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_LOCALRECORDER, value.ToString());//生成保存本地
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("LocalRecorder"));
}
}
}
/// <summary> /// <summary>
/// 录制倒计时 /// 录制倒计时
/// </summary> /// </summary>
@ -864,7 +798,7 @@ namespace JianGongYun.TRTC.ViewModels
{ {
var videoResolution = TRTCVideoResolution.TRTCVideoResolution_1920_1080; var videoResolution = TRTCVideoResolution.TRTCVideoResolution_1920_1080;
uint videoBitrate = 2000; uint videoBitrate = 2000;
switch (LiveSubLevel) switch (LiveMainLevel)
{ {
case LiveLevelEnum.Low: case LiveLevelEnum.Low:
videoResolution = TRTCVideoResolution.TRTCVideoResolution_960_540; videoResolution = TRTCVideoResolution.TRTCVideoResolution_960_540;
@ -950,7 +884,7 @@ namespace JianGongYun.TRTC.ViewModels
#region #region
//配置文件路径 //配置文件路径
private string sPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "TRTCConfig.ini"); private string sPath = ".\\TRTCConfig.ini";
//根节点 //根节点
private const string INI_ROOT_KEY = "TRTCLOCALCONFIG"; private const string INI_ROOT_KEY = "TRTCLOCALCONFIG";
//设备 //设备
@ -965,7 +899,6 @@ namespace JianGongYun.TRTC.ViewModels
//private const string INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE = "INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE";//音频码率 //private const string INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE = "INI_KEY_SCREEN_RECORDING_AUDIO_BITRATE";//音频码率
//private const string INI_KEY_SCREEN_RECORDING_AUDIO_FREQ = "INI_KEY_SCREEN_RECORDING_AUDIO_FREQ";//音频采样率 //private const string INI_KEY_SCREEN_RECORDING_AUDIO_FREQ = "INI_KEY_SCREEN_RECORDING_AUDIO_FREQ";//音频采样率
//private const string INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL = "INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL";//编码级别 //private const string INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL = "INI_KEY_SCREEN_RECORDING_PROFILE_LEVEL";//编码级别
private const string INI_KEY_SCREEN_LOCALRECORDER = "INI_KEY_SCREEN_LOCALRECORDER";//本地录制
private const string INI_KEY_SCREEN_RECORDING_COUNTDOWN = "INI_KEY_SCREEN_RECORDING_COUNTDOWN";//录制倒计时 private const string INI_KEY_SCREEN_RECORDING_COUNTDOWN = "INI_KEY_SCREEN_RECORDING_COUNTDOWN";//录制倒计时
private const string INI_KEY_SCREEN_RECORDING_DIR = "INI_KEY_SCREEN_RECORDING_DIR";//录制保存路径 private const string INI_KEY_SCREEN_RECORDING_DIR = "INI_KEY_SCREEN_RECORDING_DIR";//录制保存路径
//直播 //直播

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"
@ -18,7 +18,6 @@
<Geometry x:Key="Icon_Camera">M512 85.33312C323.499138 85.33312 170.66752 238.164738 170.66752 426.6656s152.831618 341.33248 341.33248 341.33248 341.33248-152.831618 341.33248-341.33248S700.500862 85.33312 512 85.33312zM85.3344 426.6656C85.3344 191.032411 276.366811 0 512 0c235.661633 0 426.6656 191.032411 426.6656 426.6656 0 235.661633-191.003967 426.6656-426.6656 426.6656-235.633189 0-426.6656-191.003967-426.6656-426.6656z m127.99968 554.66528A42.66656 42.66656 0 0 1 256.00064 938.66432h511.99872a42.66656 42.66656 0 1 1 0 85.33312H256.00064a42.66656 42.66656 0 0 1-42.66656-42.66656z M459.776131 775.166062a42.239894 42.239894 0 0 1 19.114618 56.888747l-85.560675 169.642242a42.951004 42.951004 0 0 1-56.774969 17.806178 42.239894 42.239894 0 0 1-19.71195-55.722527l85.560675-169.642243a42.951004 42.951004 0 0 1 57.372301-18.972397z m132.892112 0a42.239894 42.239894 0 0 0-19.114619 56.888747l85.560675 169.642242a42.951004 42.951004 0 0 0 56.774969 17.806178 42.239894 42.239894 0 0 0 19.711951-55.722527l-85.560675-169.642243a42.951004 42.951004 0 0 0-57.372301-18.972397zM526.222187 321.136975c-61.439846 0-111.2175 49.350988-111.2175 110.250391 0 60.927848 49.777653 110.278835 111.2175 110.278835s111.2175-49.350988 111.217499-110.278835c0-60.870959-49.777653-110.250391-111.217499-110.250391z m-196.806619 110.250391c0-107.747286 88.120669-195.099957 196.806619-195.099957 108.685951 0 196.806619 87.352671 196.806619 195.128401 0 107.747286-88.120669 195.099957-196.806619 195.099957-108.685951 0-196.806619-87.352671-196.806619-195.128401zM526.222187 28.444373c23.60883 0 42.780337 19.000841 42.780337 42.410561v63.630063c0 23.409719-19.143063 42.382116-42.780337 42.382116-23.60883 0-42.780337-18.972397-42.780338-42.382116V70.82649c0-23.409719 19.143063-42.410561 42.780338-42.410561z</Geometry> <Geometry x:Key="Icon_Camera">M512 85.33312C323.499138 85.33312 170.66752 238.164738 170.66752 426.6656s152.831618 341.33248 341.33248 341.33248 341.33248-152.831618 341.33248-341.33248S700.500862 85.33312 512 85.33312zM85.3344 426.6656C85.3344 191.032411 276.366811 0 512 0c235.661633 0 426.6656 191.032411 426.6656 426.6656 0 235.661633-191.003967 426.6656-426.6656 426.6656-235.633189 0-426.6656-191.003967-426.6656-426.6656z m127.99968 554.66528A42.66656 42.66656 0 0 1 256.00064 938.66432h511.99872a42.66656 42.66656 0 1 1 0 85.33312H256.00064a42.66656 42.66656 0 0 1-42.66656-42.66656z M459.776131 775.166062a42.239894 42.239894 0 0 1 19.114618 56.888747l-85.560675 169.642242a42.951004 42.951004 0 0 1-56.774969 17.806178 42.239894 42.239894 0 0 1-19.71195-55.722527l85.560675-169.642243a42.951004 42.951004 0 0 1 57.372301-18.972397z m132.892112 0a42.239894 42.239894 0 0 0-19.114619 56.888747l85.560675 169.642242a42.951004 42.951004 0 0 0 56.774969 17.806178 42.239894 42.239894 0 0 0 19.711951-55.722527l-85.560675-169.642243a42.951004 42.951004 0 0 0-57.372301-18.972397zM526.222187 321.136975c-61.439846 0-111.2175 49.350988-111.2175 110.250391 0 60.927848 49.777653 110.278835 111.2175 110.278835s111.2175-49.350988 111.217499-110.278835c0-60.870959-49.777653-110.250391-111.217499-110.250391z m-196.806619 110.250391c0-107.747286 88.120669-195.099957 196.806619-195.099957 108.685951 0 196.806619 87.352671 196.806619 195.128401 0 107.747286-88.120669 195.099957-196.806619 195.099957-108.685951 0-196.806619-87.352671-196.806619-195.128401zM526.222187 28.444373c23.60883 0 42.780337 19.000841 42.780337 42.410561v63.630063c0 23.409719-19.143063 42.382116-42.780337 42.382116-23.60883 0-42.780337-18.972397-42.780338-42.382116V70.82649c0-23.409719 19.143063-42.410561 42.780338-42.410561z</Geometry>
<Geometry x:Key="Icon_Screen">M864 159.872L160 160c-17.696 0-32 14.176-32 31.872v448a32 32 0 0 0 32 32h704a32 32 0 0 0 32-32v-448a32 32 0 0 0-32-32zM864 640H160V191.872h704V640z M928 32H96a96 96 0 0 0-96 96v640a95.904 95.904 0 0 0 95.68 95.936H416v38.944l-199.744 25.952A31.968 31.968 0 0 0 224 991.872h576a32 32 0 0 0 7.744-63.072L608 902.88v-38.944h320.32A95.904 95.904 0 0 0 1024 768V128a96 96 0 0 0-96-96z m32 736c0 17.632-14.368 32-32 32H96c-17.664 0-32-14.368-32-32V128a32 32 0 0 1 32-32h832c17.632 0 32 14.336 32 32v640z</Geometry> <Geometry x:Key="Icon_Screen">M864 159.872L160 160c-17.696 0-32 14.176-32 31.872v448a32 32 0 0 0 32 32h704a32 32 0 0 0 32-32v-448a32 32 0 0 0-32-32zM864 640H160V191.872h704V640z M928 32H96a96 96 0 0 0-96 96v640a95.904 95.904 0 0 0 95.68 95.936H416v38.944l-199.744 25.952A31.968 31.968 0 0 0 224 991.872h576a32 32 0 0 0 7.744-63.072L608 902.88v-38.944h320.32A95.904 95.904 0 0 0 1024 768V128a96 96 0 0 0-96-96z m32 736c0 17.632-14.368 32-32 32H96c-17.664 0-32-14.368-32-32V128a32 32 0 0 1 32-32h832c17.632 0 32 14.336 32 32v640z</Geometry>
<Geometry x:Key="Icon_Mic">M486.4 972.8v-128.9728A332.8 332.8 0 0 1 179.2 512a25.6 25.6 0 0 1 51.2 0 281.6 281.6 0 0 0 563.2 0 25.6 25.6 0 1 1 51.2 0 332.8 332.8 0 0 1-307.2 331.8272V972.8h153.6a25.6 25.6 0 1 1 0 51.2h-358.4a25.6 25.6 0 1 1 0-51.2h153.6zM512 51.2a153.6 153.6 0 0 0-153.6 153.6v307.2a153.6 153.6 0 0 0 307.2 0V204.8a153.6 153.6 0 0 0-153.6-153.6z m0-51.2a204.8 204.8 0 0 1 204.8 204.8v307.2a204.8 204.8 0 1 1-409.6 0V204.8a204.8 204.8 0 0 1 204.8-204.8z</Geometry> <Geometry x:Key="Icon_Mic">M486.4 972.8v-128.9728A332.8 332.8 0 0 1 179.2 512a25.6 25.6 0 0 1 51.2 0 281.6 281.6 0 0 0 563.2 0 25.6 25.6 0 1 1 51.2 0 332.8 332.8 0 0 1-307.2 331.8272V972.8h153.6a25.6 25.6 0 1 1 0 51.2h-358.4a25.6 25.6 0 1 1 0-51.2h153.6zM512 51.2a153.6 153.6 0 0 0-153.6 153.6v307.2a153.6 153.6 0 0 0 307.2 0V204.8a153.6 153.6 0 0 0-153.6-153.6z m0-51.2a204.8 204.8 0 0 1 204.8 204.8v307.2a204.8 204.8 0 1 1-409.6 0V204.8a204.8 204.8 0 0 1 204.8-204.8z</Geometry>
<Geometry x:Key="Icon_SysSound">M585.955556 896c-9.197037 0-18.299259-2.74963-26.168889-8.248889l-288.237037-202.145185h-101.451852c-23.22963 0-42.097778-18.583704-42.097778-41.528889V379.922963c0-22.85037 18.868148-41.528889 42.097778-41.528889h101.451852l288.237037-202.145185c14.032593-9.765926 32.142222-10.998519 47.312592-3.128889 14.885926 7.68 24.082963 22.85037 24.082963 39.348148v678.874074c0 16.592593-9.197037 31.668148-24.082963 39.348148-6.637037 3.602963-13.937778 5.30963-21.143703 5.30963zM170.666667 642.939259h114.346666l299.330371 209.92c0.948148 0.663704 1.991111 0.758519 3.128889 0.18963 1.137778-0.568889 1.137778-1.232593 1.137777-1.517037V172.562963c0-0.284444 0-0.948148-1.137777-1.517037-1.137778-0.568889-2.180741-0.474074-3.128889 0.18963L285.013333 381.060741H170.666667v261.878518zM757.57037 758.423704c-6.637037 0-13.179259-3.128889-17.351111-8.912593-6.826667-9.576296-4.645926-22.945185 4.930371-29.771852C812.847407 671.194074 853.333333 593.351111 853.333333 511.81037s-40.391111-159.194074-107.994074-207.834074c-9.576296-6.921481-11.757037-20.195556-4.835555-29.771852 6.921481-9.576296 20.195556-11.757037 29.771852-4.835555 38.115556 27.401481 69.688889 63.525926 91.401481 104.391111 22.471111 42.382222 34.322963 90.074074 34.322963 138.05037 0 48.071111-11.851852 95.857778-34.417778 138.24-21.712593 40.96-53.380741 77.084444-91.591111 104.485926-3.792593 2.56-8.059259 3.887407-12.420741 3.887408z M701.345185 703.715556c-7.016296 0-13.937778-3.508148-18.014815-9.860741-6.352593-9.955556-3.413333-23.134815 6.542223-29.487408 53.285926-33.848889 85.143704-90.927407 85.143703-152.651851 0-61.534815-31.762963-118.613333-84.859259-152.462223-9.955556-6.352593-12.894815-19.531852-6.542222-29.487407 6.352593-9.955556 19.531852-12.894815 29.487407-6.542222 65.517037 41.813333 104.580741 112.260741 104.580741 188.491852 0 76.325926-39.253333 146.868148-104.96 188.681481-3.508148 2.275556-7.49037 3.318519-11.377778 3.318519z</Geometry>
<Geometry x:Key="Icon_User">M511.626 1.896C229.572 1.896 0.927 230.541 0.927 512.595c0 282.055 228.645 510.699 510.699 510.699s510.698-228.645 510.698-510.699S793.68 1.896 511.626 1.896z m0 69.641c243.606 0 441.058 197.474 441.058 441.058 0 87.347-25.392 168.762-69.194 237.271-73.419-77.609-170.944-132.204-280.597-151.829 70.004-33.755 118.404-105.164 118.404-188.066 0-115.388-93.535-208.922-208.923-208.922S303.452 294.583 303.452 409.97c0 82.902 48.399 154.311 118.403 188.066-110.093 19.704-207.96 74.661-281.479 152.77-44.177-68.704-69.808-150.465-69.808-238.211 0-243.584 197.496-441.058 441.058-441.058z</Geometry> <Geometry x:Key="Icon_User">M511.626 1.896C229.572 1.896 0.927 230.541 0.927 512.595c0 282.055 228.645 510.699 510.699 510.699s510.698-228.645 510.698-510.699S793.68 1.896 511.626 1.896z m0 69.641c243.606 0 441.058 197.474 441.058 441.058 0 87.347-25.392 168.762-69.194 237.271-73.419-77.609-170.944-132.204-280.597-151.829 70.004-33.755 118.404-105.164 118.404-188.066 0-115.388-93.535-208.922-208.923-208.922S303.452 294.583 303.452 409.97c0 82.902 48.399 154.311 118.403 188.066-110.093 19.704-207.96 74.661-281.479 152.77-44.177-68.704-69.808-150.465-69.808-238.211 0-243.584 197.496-441.058 441.058-441.058z</Geometry>
<Geometry x:Key="Icon_ChangeScreen">M447.5904 819.1488H166.4a89.6 89.6 0 0 1-89.6-89.4976V166.4c0-49.3568 40.192-89.5488 89.6-89.5488h563.2c49.4592 0 89.6512 40.192 89.6512 89.5488v281.6H896v-281.6A166.5536 166.5536 0 0 0 729.6 0h-563.2A166.5536 166.5536 0 0 0 0 166.4v563.2512A166.656 166.656 0 0 0 166.4 896h281.1904v-76.8512z M947.2 238.5408V857.6c0 49.408-40.192 89.6-89.6 89.6H242.7904V1024H857.6A166.6048 166.6048 0 0 0 1024 857.6V238.5408h-76.8z M577.8944 813.8752h235.9808v-236.032h-76.8v104.96l-395.776-395.8784h104.9088V210.176H210.1248v235.9808h76.8V341.248l395.9296 395.8784h-104.96z</Geometry> <Geometry x:Key="Icon_ChangeScreen">M447.5904 819.1488H166.4a89.6 89.6 0 0 1-89.6-89.4976V166.4c0-49.3568 40.192-89.5488 89.6-89.5488h563.2c49.4592 0 89.6512 40.192 89.6512 89.5488v281.6H896v-281.6A166.5536 166.5536 0 0 0 729.6 0h-563.2A166.5536 166.5536 0 0 0 0 166.4v563.2512A166.656 166.656 0 0 0 166.4 896h281.1904v-76.8512z M947.2 238.5408V857.6c0 49.408-40.192 89.6-89.6 89.6H242.7904V1024H857.6A166.6048 166.6048 0 0 0 1024 857.6V238.5408h-76.8z M577.8944 813.8752h235.9808v-236.032h-76.8v104.96l-395.776-395.8784h104.9088V210.176H210.1248v235.9808h76.8V341.248l395.9296 395.8784h-104.96z</Geometry>
<Geometry x:Key="Icon_Ban">M2.896 921.614L924.656 0l102.385 102.386L105.354 1024z</Geometry> <Geometry x:Key="Icon_Ban">M2.896 921.614L924.656 0l102.385 102.386L105.354 1024z</Geometry>
@ -62,80 +61,16 @@
<TextBlock FontSize="14" Foreground="#3d7cf9" Text="{Binding StudentCount,Mode=OneWay}"></TextBlock> <TextBlock FontSize="14" Foreground="#3d7cf9" Text="{Binding StudentCount,Mode=OneWay}"></TextBlock>
<TextBlock FontSize="14" Padding="3 0 0 0" Foreground="#bbbbbb" Text="人"></TextBlock> <TextBlock FontSize="14" Padding="3 0 0 0" Foreground="#bbbbbb" Text="人"></TextBlock>
</StackPanel> </StackPanel>
<Metro:AduFlatButton Content="开始直播" IsEnabled="{Binding TRTCConneced}" Click="StartLive_Click" Tag="True" Canvas.Bottom="13" Canvas.Right="25" Visibility="{Binding IsLive, Converter={StaticResource UnVisibilityOfBool}}"></Metro:AduFlatButton> <Metro:AduFlatButton Content="开始直播" Click="StartLive_Click" Tag="True" Canvas.Bottom="13" Canvas.Right="25" Visibility="{Binding IsLive, Converter={StaticResource UnVisibilityOfBool}}"></Metro:AduFlatButton>
<Metro:AduFlatButton Content="结束直播" x:Name="stoplive" Click="StartLive_Click" Tag="False" Type="error" Canvas.Bottom="13" Canvas.Right="25" Visibility="{Binding IsLive, Converter={StaticResource VisibilityOfBool}}"></Metro:AduFlatButton> <Metro:AduFlatButton Content="结束直播" Click="StartLive_Click" Tag="False" Type="error" Canvas.Bottom="13" Canvas.Right="25" Visibility="{Binding IsLive, Converter={StaticResource VisibilityOfBool}}"></Metro:AduFlatButton>
<StackPanel Visibility="{Binding IsLive, Converter={StaticResource VisibilityOfBool}}" Orientation="Horizontal" Canvas.Bottom="20" Canvas.Right="150"> <StackPanel Visibility="{Binding IsLive, Converter={StaticResource VisibilityOfBool}}" Orientation="Horizontal" Canvas.Bottom="20" Canvas.Right="150">
<Ellipse Visibility="{Binding TRTCConneced, Converter={StaticResource VisibilityOfBool}}" VerticalAlignment="Center" Width="10" Fill="#00cc66" Height="10"></Ellipse> <Ellipse VerticalAlignment="Center" Width="10" Fill="#00cc66" Height="10"></Ellipse>
<Ellipse Visibility="{Binding TRTCConneced, Converter={StaticResource UnVisibilityOfBool}}" VerticalAlignment="Center" Width="10" Fill="Red" Height="10"></Ellipse> <TextBlock FontSize="15" Foreground="White" Margin="7 0 0 0">直播中</TextBlock>
<TextBlock Visibility="{Binding TRTCConneced, Converter={StaticResource VisibilityOfBool}}" FontSize="15" Foreground="White" Margin="7 0 0 0">直播中</TextBlock>
<TextBlock Visibility="{Binding TRTCConneced, Converter={StaticResource UnVisibilityOfBool}}" FontSize="15" Foreground="Red" Margin="7 0 0 0">重连中</TextBlock>
<TextBlock FontSize="15" Foreground="White" Margin="7 0 0 0" Text="{Binding LiveTimeCount}"></TextBlock> <TextBlock FontSize="15" Foreground="White" Margin="7 0 0 0" Text="{Binding LiveTimeCount}"></TextBlock>
</StackPanel> </StackPanel>
</Canvas> </Canvas>
<!--右方聊天学员面板--> <!--右方聊天学员面板-->
<Canvas x:Name="ChatWrap" DockPanel.Dock="Right" Width="280" Background="#2f3035"> <Canvas DockPanel.Dock="Right" Width="280" Background="#2f3035">
<DockPanel Height="{Binding ElementName=ChatWrap,Path=ActualHeight}" Width="{Binding ElementName=ChatWrap,Path=ActualWidth}">
<DockPanel Height="60" DockPanel.Dock="Bottom">
<Button PreviewKeyDown="Button_PreviewKeyDown" Click="Button_Click" Foreground="White" Background="#3e7fff" Margin="0 12 12 12" Width="70" DockPanel.Dock="Right">发 送</Button>
<TextBox x:Name="ChatIpt" PreviewKeyDown="TextBox_PreviewKeyDown" VerticalContentAlignment="Center" Padding="12 0" Foreground="White" Background="Transparent" Margin="12 12 0 12"></TextBox>
</DockPanel>
<Border BorderBrush="#888" BorderThickness="0 0 0 1">
<Grid>
<local:ScrollingListBox x:Name="ChatList" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding Chats}" Background="Transparent">
<ListBox.Resources>
<Style TargetType="ScrollViewer" BasedOn="{StaticResource CusScroll}"></Style>
<Style TargetType="local:ScrollingListBox">
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="Border" BorderThickness="0">
<Label x:Name="Label" VerticalAlignment="Center" Padding="12" HorizontalAlignment="Left" FontSize="13px">
<ContentPresenter></ContentPresenter>
</Label>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="BorderBrush" Value="#efefef"></Setter>
<!--<Setter TargetName="Border" Property="Background" Value="{StaticResource itembg}"></Setter>-->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<!--自定义ListBox项样式-->
<DataTemplate>
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Foreground="#3c77eb" TextWrapping="Wrap" Text="{Binding Path=Nick}">
</TextBlock>
<TextBlock Margin="6 0 0 0" Foreground="#888888" TextWrapping="Wrap" Text="{Binding Path=Date}">
</TextBlock>
</StackPanel>
<TextBlock Margin="0 6 0 0" Foreground="White" TextWrapping="Wrap" Text="{Binding Path=Body}">
</TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</local:ScrollingListBox>
</Grid>
</Border>
</DockPanel>
<Grid Visibility="{Binding WSConneced, Converter={StaticResource UnVisibilityOfBool}}" Canvas.Left="0" Canvas.Top="0" Height="{Binding ElementName=ChatWrap,Path=ActualHeight}" Width="{Binding ElementName=ChatWrap,Path=ActualWidth}" Background="#dd2a2b30">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<Metro:AduLoading Margin="0,0,0,0" x:Name="ChatConnIcon" SpeedRatio="1" Foreground="White" Type="Lines" IsActived="True" Height="30"/>
<!--<Label FontSize="14" Foreground="#bbbbbb">连接中</Label>-->
</StackPanel>
</Grid>
</Canvas> </Canvas>
<!--下方教程面板--> <!--下方教程面板-->
<Canvas DockPanel.Dock="Bottom" Height="30" Background="#2a2b30"> <Canvas DockPanel.Dock="Bottom" Height="30" Background="#2a2b30">
@ -153,12 +88,8 @@
</Button> </Button>
<StackPanel Visibility="{Binding IsLive, Converter={StaticResource VisibilityOfBool}}" Orientation="Horizontal" Canvas.Right="27" Canvas.Top="10" Height="50"> <StackPanel Visibility="{Binding IsLive, Converter={StaticResource VisibilityOfBool}}" Orientation="Horizontal" Canvas.Right="27" Canvas.Top="10" Height="50">
<Canvas HorizontalAlignment="Right" Height="50" Width="50"> <Canvas HorizontalAlignment="Right" Height="50" Width="50">
<Metro:AduSysButton ToolTip="禁用/启用麦克风" Click="SetMute_Click" Tag="mic" Foreground="#aaaaaa" IconHeight="25" IconWidth="18" CornerRadius="6" Height="50" Width="50" Icon="{StaticResource Icon_Mic}" Content="" /> <Metro:AduSysButton ToolTip="禁用/启用麦克风静音" Click="SetMute_Click" Foreground="#aaaaaa" IconHeight="25" IconWidth="18" CornerRadius="6" Height="50" Width="50" Icon="{StaticResource Icon_Mic}" Content="" />
<Metro:AduSysButton ToolTip="禁用/启用麦克风" Click="SetMute_Click" Tag="mic" Visibility="{Binding MicMute, Converter={StaticResource VisibilityOfBool}}" Foreground="#aaaaaa" IconHeight="25" IconWidth="25" CornerRadius="6" Height="50" Width="50" Icon="{StaticResource Icon_Ban}" Content="" /> <Metro:AduSysButton ToolTip="禁用/启用麦克风静音" Click="SetMute_Click" Visibility="{Binding MicMute, Converter={StaticResource VisibilityOfBool}}" Foreground="#aaaaaa" IconHeight="25" IconWidth="25" CornerRadius="6" Height="50" Width="50" Icon="{StaticResource Icon_Ban}" Content="" />
</Canvas>
<Canvas HorizontalAlignment="Right" Height="50" Width="50">
<Metro:AduSysButton ToolTip="禁用/启用系统音" Click="SetMute_Click" Tag="sys" Foreground="#aaaaaa" IconHeight="25" IconWidth="23" CornerRadius="6" Height="50" Width="50" Icon="{StaticResource Icon_SysSound}" Content="" />
<Metro:AduSysButton ToolTip="禁用/启用系统音" Click="SetMute_Click" Tag="sys" Visibility="{Binding SysMute, Converter={StaticResource VisibilityOfBool}}" Foreground="#aaaaaa" IconHeight="25" IconWidth="25" CornerRadius="6" Height="50" Width="50" Icon="{StaticResource Icon_Ban}" Content="" />
</Canvas> </Canvas>
<Canvas HorizontalAlignment="Right" Height="50" Width="50"> <Canvas HorizontalAlignment="Right" Height="50" Width="50">
<Metro:AduSysButton ToolTip="禁用/启用摄像头" Click="SetCamera_Click" Foreground="#aaaaaa" IconHeight="25" IconWidth="20" CornerRadius="6" Height="50" Width="50" Icon="{StaticResource Icon_Camera}" Content="" /> <Metro:AduSysButton ToolTip="禁用/启用摄像头" Click="SetCamera_Click" Foreground="#aaaaaa" IconHeight="25" IconWidth="20" CornerRadius="6" Height="50" Width="50" Icon="{StaticResource Icon_Camera}" Content="" />
@ -182,13 +113,13 @@
<Grid x:Name="BeforeLiveSubViewWrap" Width="{Binding ElementName=BeforeLivePanel,Path=ActualWidth}" Height="{Binding ElementName=BeforeLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"></Grid> <Grid x:Name="BeforeLiveSubViewWrap" Width="{Binding ElementName=BeforeLivePanel,Path=ActualWidth}" Height="{Binding ElementName=BeforeLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"></Grid>
<!--标题和直播类型选项--> <!--标题和直播类型选项-->
<Grid Width="{Binding ElementName=BeforeLivePanel,Path=ActualWidth}" Height="{Binding ElementName=BeforeLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"> <Grid Width="{Binding ElementName=BeforeLivePanel,Path=ActualWidth}" Height="{Binding ElementName=BeforeLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0">
<StackPanel Width="500" VerticalAlignment="Center"> <StackPanel Width="700" VerticalAlignment="Center">
<TextBlock FontSize="30" Foreground="#999999" HorizontalAlignment="Center">请选择授课方式</TextBlock> <TextBlock FontSize="30" Foreground="#999999" HorizontalAlignment="Center">请选择授课方式</TextBlock>
<TextBlock HorizontalAlignment="Center" FontSize="16" Margin="0 10 0 0" Foreground="#999999">您可在上课期间随时调整授课方式</TextBlock> <TextBlock HorizontalAlignment="Center" FontSize="16" Margin="0 10 0 0" Foreground="#999999">您可在上课期间随时调整授课方式</TextBlock>
<Grid Margin="0 30 0 0" Height="300"> <Grid Margin="0 30 0 0" Height="300">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<!--<ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>--> <ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
@ -196,8 +127,7 @@
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<!--Grid.RowSpan="2" Grid.ColumnSpan="2"--> <Grid Margin="5" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Grid.ColumnSpan="2" Background="#2f3035">
<Grid Margin="5" Grid.Row="0" Grid.Column="0" Background="#2f3035">
<Canvas x:Name="CameraPrew"> <Canvas x:Name="CameraPrew">
<Grid Width="{Binding ElementName=CameraPrew,Path=ActualWidth}" Height="{Binding ElementName=CameraPrew,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"> <Grid Width="{Binding ElementName=CameraPrew,Path=ActualWidth}" Height="{Binding ElementName=CameraPrew,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0">
<Path Margin="0 0 0 30" Width="111" Height="111" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_User}" /> <Path Margin="0 0 0 30" Width="111" Height="111" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_User}" />
@ -207,7 +137,7 @@
<TextBlock Width="{Binding ElementName=CameraPrew,Path=ActualWidth}" Canvas.Bottom="0" Canvas.Left="0" Padding="5" FontSize="14" Foreground="#cccccc" Background="#65888888" TextAlignment="Center">摄像头预览</TextBlock> <TextBlock Width="{Binding ElementName=CameraPrew,Path=ActualWidth}" Canvas.Bottom="0" Canvas.Left="0" Padding="5" FontSize="14" Foreground="#cccccc" Background="#65888888" TextAlignment="Center">摄像头预览</TextBlock>
</Canvas> </Canvas>
</Grid> </Grid>
<!--<Grid Margin="5" Background="#2f3035" Grid.Row="0" Grid.Column="2"> <Grid Margin="5" Background="#2f3035" Grid.Row="0" Grid.Column="2">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<StackPanel Margin="0 0 0 20" HorizontalAlignment="Center" Orientation="Horizontal"> <StackPanel Margin="0 0 0 20" HorizontalAlignment="Center" Orientation="Horizontal">
<Path Width="30" Height="35" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_Camera}" /> <Path Width="30" Height="35" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_Camera}" />
@ -216,24 +146,23 @@
</StackPanel> </StackPanel>
<Metro:AduRadioButton x:Name="Rad1" Click="Tpye_Click" GroupName="LiveType" Foreground="#cccccc" Content="摄像头+屏幕分享" FontSize="14" IconWidth="16" IsChecked="{Binding LiveType,Converter={StaticResource LiveTypeConverter},ConverterParameter=CameraAndScreen}" /> <Metro:AduRadioButton x:Name="Rad1" Click="Tpye_Click" GroupName="LiveType" Foreground="#cccccc" Content="摄像头+屏幕分享" FontSize="14" IconWidth="16" IsChecked="{Binding LiveType,Converter={StaticResource LiveTypeConverter},ConverterParameter=CameraAndScreen}" />
</StackPanel> </StackPanel>
</Grid>--> </Grid>
<Grid Margin="5" Background="#2f3035" Grid.Row="1" Grid.Column="0"> <Grid Margin="5" Background="#2f3035" Grid.Row="0" Grid.Column="3">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Path Margin="0 0 0 30" Width="30" Height="30" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_Screen}" /> <Path Margin="0 0 0 30" Width="30" Height="30" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_Screen}" />
<Metro:AduRadioButton x:Name="Rad2" Click="Tpye_Click" GroupName="LiveType" Foreground="#cccccc" Content="屏幕分享" FontSize="14" IconWidth="16" IsChecked="{Binding LiveType,Converter={StaticResource LiveTypeConverter},ConverterParameter=OnlyScreen}" /> <Metro:AduRadioButton x:Name="Rad2" Click="Tpye_Click" GroupName="LiveType" Foreground="#cccccc" Content="屏幕分享" FontSize="14" IconWidth="16" IsChecked="{Binding LiveType,Converter={StaticResource LiveTypeConverter},ConverterParameter=OnlyScreen}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Grid Margin="5" Background="#2f3035" Grid.Row="0" Grid.Column="1"> <Grid Margin="5" Background="#2f3035" Grid.Row="1" Grid.Column="2">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Path Margin="0 0 0 25" Width="30" Height="35" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_Camera}" /> <Path Margin="0 0 0 25" Width="30" Height="35" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_Camera}" />
<Metro:AduRadioButton x:Name="Rad3" Click="Tpye_Click" GroupName="LiveType" Foreground="#cccccc" Content="摄像头" FontSize="14" IconWidth="16" IsChecked="{Binding LiveType,Converter={StaticResource LiveTypeConverter},ConverterParameter=OnlyCamera}" /> <Metro:AduRadioButton x:Name="Rad3" Click="Tpye_Click" GroupName="LiveType" Foreground="#cccccc" Content="摄像头" FontSize="14" IconWidth="16" IsChecked="{Binding LiveType,Converter={StaticResource LiveTypeConverter},ConverterParameter=OnlyCamera}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Grid Margin="5" Background="#2f3035" Grid.Row="1" Grid.Column="1"> <Grid Margin="5" Background="#2f3035" Grid.Row="1" Grid.Column="3">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Path Margin="0 0 0 15" Width="30" Height="45" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_Mic}" /> <Path Margin="0 0 0 15" Width="30" Height="45" Fill="#cccccc" Shape.Stretch="Fill" Data="{StaticResource Icon_Mic}" />
<!--仅声音--> <Metro:AduRadioButton x:Name="Rad4" Click="Tpye_Click" GroupName="LiveType" Foreground="#cccccc" Content="仅声音" FontSize="14" IconWidth="16" IsChecked="{Binding LiveType,Converter={StaticResource LiveTypeConverter},ConverterParameter=OnlyAudio}" />
<Metro:AduRadioButton x:Name="Rad4" Click="Tpye_Click" GroupName="LiveType" Foreground="#cccccc" Content="分享桌面开始直播" FontSize="14" IconWidth="16" IsChecked="{Binding LiveType,Converter={StaticResource LiveTypeConverter},ConverterParameter=OnlyAudio}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</Grid> </Grid>
@ -244,12 +173,12 @@
<!--直播中--> <!--直播中-->
<Grid Canvas.Top="0" Canvas.Left="0" Height="{Binding ElementName=CusContent,Path=ActualHeight}" Width="{Binding ElementName=CusContent,Path=ActualWidth}" Visibility="{Binding IsLive, Converter={StaticResource VisibilityOfBool}}"> <Grid Canvas.Top="0" Canvas.Left="0" Height="{Binding ElementName=CusContent,Path=ActualHeight}" Width="{Binding ElementName=CusContent,Path=ActualWidth}" Visibility="{Binding IsLive, Converter={StaticResource VisibilityOfBool}}">
<Canvas x:Name="AfterLivePanel"> <Canvas x:Name="AfterLivePanel">
<Grid Width="{Binding ElementName=AfterLivePanel,Path=ActualWidth}" Height="{Binding ElementName=AfterLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"> <Grid Visibility="{Binding MicMute, Converter={StaticResource UnVisibilityOfBool}}" Width="{Binding ElementName=AfterLivePanel,Path=ActualWidth}" Height="{Binding ElementName=AfterLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#aaaaaa" FontSize="14" Text="{Binding SoundTip,Mode=OneWay}" ></TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#aaaaaa" FontSize="14" >仅开启麦克风</TextBlock>
</Grid> </Grid>
<!--<Grid Visibility="{Binding MicMute, Converter={StaticResource VisibilityOfBool}}" Width="{Binding ElementName=AfterLivePanel,Path=ActualWidth}" Height="{Binding ElementName=AfterLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"> <Grid Visibility="{Binding MicMute, Converter={StaticResource VisibilityOfBool}}" Width="{Binding ElementName=AfterLivePanel,Path=ActualWidth}" Height="{Binding ElementName=AfterLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#aaaaaa" FontSize="14" >所有设备被关闭</TextBlock> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#aaaaaa" FontSize="14" >所有设备被关闭</TextBlock>
</Grid>--> </Grid>
<!--屏幕预览容器--> <!--屏幕预览容器-->
<Grid x:Name="AfterLiveSubViewWrap" Width="{Binding ElementName=AfterLivePanel,Path=ActualWidth}" Height="{Binding ElementName=AfterLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"></Grid> <Grid x:Name="AfterLiveSubViewWrap" Width="{Binding ElementName=AfterLivePanel,Path=ActualWidth}" Height="{Binding ElementName=AfterLivePanel,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"></Grid>
<!--摄像头预览容器--> <!--摄像头预览容器-->
@ -275,7 +204,6 @@
<TextBlock Foreground="White" FontSize="20" FontWeight="Bold" Padding="10" HorizontalAlignment="Center" VerticalAlignment="Center">请选择要分享的屏幕或前台窗口(上课期间可随时切换)</TextBlock> <TextBlock Foreground="White" FontSize="20" FontWeight="Bold" Padding="10" HorizontalAlignment="Center" VerticalAlignment="Center">请选择要分享的屏幕或前台窗口(上课期间可随时切换)</TextBlock>
</StackPanel> </StackPanel>
<!--列表视图--> <!--列表视图-->
<!--Style="{StaticResource CusScroll}"-->
<ScrollViewer Style="{StaticResource CusScroll}" Canvas.Right="0" Canvas.Top="50" Height="480" Width="{Binding ElementName=ScrollWrap,Path=ActualWidth}"> <ScrollViewer Style="{StaticResource CusScroll}" Canvas.Right="0" Canvas.Top="50" Height="480" Width="{Binding ElementName=ScrollWrap,Path=ActualWidth}">
<ListBox MouseUp="ShareList_Selected" SelectedValuePath="Info" SelectedValue="{Binding CurrentShareScreen}" ItemsSource="{Binding LiveScreens}" Template="{StaticResource ShareListTemplate}" ItemTemplate="{StaticResource ShareListItemTemplate}"></ListBox> <ListBox MouseUp="ShareList_Selected" SelectedValuePath="Info" SelectedValue="{Binding CurrentShareScreen}" ItemsSource="{Binding LiveScreens}" Template="{StaticResource ShareListTemplate}" ItemTemplate="{StaticResource ShareListItemTemplate}"></ListBox>
</ScrollViewer> </ScrollViewer>

View File

@ -16,10 +16,6 @@ using System.Windows.Threading;
using JianGongYun.TRTC.Components; using JianGongYun.TRTC.Components;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.ComponentModel; using System.ComponentModel;
using Websocket.Client;
using Newtonsoft.Json.Linq;
using System.Diagnostics;
using JianGongYun.TRTC.Utils;
namespace JianGongYun.TRTC.Windows namespace JianGongYun.TRTC.Windows
{ {
@ -36,95 +32,26 @@ namespace JianGongYun.TRTC.Windows
public LiveWindow() public LiveWindow()
{ {
InitializeComponent(); InitializeComponent();
this.Icon = App.icon;
//this.Icon = new BitmapImage(new Uri(System.IO.Path.Combine(Environment.CurrentDirectory, "logo.ico"), UriKind.Absolute));
NoticeManager.Initialize(); NoticeManager.Initialize();
AttachConsole(-1);//把进程挂在控制台,通过命令行启动程序可以看到控制台输出 AttachConsole(-1);//把进程挂在控制台,通过命令行启动程序可以看到控制台输出
LiveWindowViewModel = new ViewModels.LiveWindowViewModel(); LiveWindowViewModel = new ViewModels.LiveWindowViewModel();
SettingWindowViewModel = ViewModels.SettingWindowViewModel.GetInstance(); SettingWindowViewModel = ViewModels.SettingWindowViewModel.GetInstance();
this.DataContext = LiveWindowViewModel; this.DataContext = LiveWindowViewModel;
BorderBrush = new SolidColorBrush(color: Color.FromRgb(42, 43, 48));//窗口标题背景颜色 BorderBrush = new SolidColorBrush(color: Color.FromRgb(42, 43, 48));//窗口标题背景颜色
for (int i = 0; i < 12; i++)
{
LiveWindowViewModel.Chats.Add(new Models.ChatEntity());//放几个空聊天数据占位置
}
Loaded += LiveWindowRightBottomBlock_Loaded1;
}
private void LiveWindowRightBottomBlock_Loaded1(object sender, RoutedEventArgs e)
{
if (ChatList.Items.Count > 0)
{
ChatList.ScrollIntoView(ChatList.Items[ChatList.Items.Count - 1]);
}
} }
/// <summary>
/// ws消息
/// </summary>
/// <param name="msg"></param>
public void OnMsg(ResponseMessage msg)
{
Debug.Print(msg.Text);
Console.WriteLine($"Message received: {msg}");
if (msg.MessageType == System.Net.WebSockets.WebSocketMessageType.Text)
{
var data = JObject.Parse(msg.Text);
var temp = data.SelectToken("extend.code");
if (temp != null)
{
var code = temp.ToObject<int>();
switch (code)
{
case 20001:
var count = data.SelectToken("extend.mess").ToObject<int>();
LiveWindowViewModel.StudentCount = count;
break;
case 30004://心跳包返回的时间
if (DateTime.TryParse(data.SelectToken("extend.date").ToObject<string>(), out var date))
{
if (date > LiveClassroom.CurrentClassroomEntity.EndTime)//结束时间关闭直播
{
this.Dispatcher.Invoke(new Action(() =>
{
AduMessageBox.ShowOK("已到结束时间", "提醒", "确定");
StartLive_Click(stoplive, null);
}));
}
}
$"心跳包回应 {msg.Text}".ToLocalLog();
break;
}
return;
}
temp = data.SelectToken("body");
if (temp != null)//发送消息后服务器的返回
{
var body = data["body"].ToString();
var nick = data["extend"]["nick"].ToString();
var time = data["extend"]["time"].ToString();
this.Dispatcher.Invoke(new Action(() =>
{
if (LiveWindowViewModel.Chats.Count > 200)
{
LiveWindowViewModel.Chats.RemoveAt(0);
}
LiveWindowViewModel.Chats.Add(new Models.ChatEntity { Body = body, Nick = nick, Date = time });
}));
}
}
}
protected override void OnActivated(EventArgs e) protected override void OnActivated(EventArgs e)
{ {
base.OnActivated(e); base.OnActivated(e);
//颜色前台设置无效,手动调用才行 //颜色前台设置无效,手动调用才行
var color = (SolidColorBrush)(new BrushConverter().ConvertFrom("#cccccc")); var color = (SolidColorBrush)(new BrushConverter().ConvertFrom("#cccccc"));
//Rad1.Foreground = color; Rad1.Foreground = color;
Rad2.Foreground = color; Rad2.Foreground = color;
Rad3.Foreground = color; Rad3.Foreground = color;
Rad4.Foreground = color; Rad4.Foreground = color;
ChatConnIcon.Foreground = new SolidColorBrush(Colors.White);
if (LiveWindowViewModel.IsLive) if (LiveWindowViewModel.IsLive)
{ {
LiveClassroom.PauseAllView(false);//切前台启动实时预览渲染 LiveClassroom.PauseAllView(false);//切前台启动实时预览渲染
@ -228,20 +155,8 @@ namespace JianGongYun.TRTC.Windows
LiveClassroom.StartVideoSub(AfterLiveSubViewWrap); LiveClassroom.StartVideoSub(AfterLiveSubViewWrap);
} }
LiveClassroom.StartMic(); LiveClassroom.StartMic();
if (SettingWindowViewModel.LocalRecorder)
{
LiveClassroom.VideoRecordTask(ref onEnd);//启动录制 LiveClassroom.VideoRecordTask(ref onEnd);//启动录制
} LiveClassroom.SetMicMute(false);
LiveClassroom.EnableAudio();
if (LiveWindowViewModel.LiveType == Models.LiveTypeEnum.OnlyAudio)//仅声音改为默认分享第一个桌面,并且收起窗口
{
this.Dispatcher.Invoke(new Action(() => LiveWindowViewModel.LoadAllScreen()));
LiveWindowViewModel.CurrentShareScreen = LiveWindowViewModel.LiveScreens?[0].Info;
LiveClassroom.StartVideoSub(AfterLiveSubViewWrap);
PackUp_Click(sender, e);
}
}, SettingWindowViewModel.ScreenRecordingCountdown); }, SettingWindowViewModel.ScreenRecordingCountdown);
} }
@ -253,15 +168,6 @@ namespace JianGongYun.TRTC.Windows
LiveClassroom.StopMic(); LiveClassroom.StopMic();
LiveClassroom.StopVideoMain(AfterLiveViewWrap); LiveClassroom.StopVideoMain(AfterLiveViewWrap);
LiveClassroom.StopVideoSub(AfterLiveSubViewWrap); LiveClassroom.StopVideoSub(AfterLiveSubViewWrap);
if (onEnd == null)
{
this.Dispatcher.Invoke(new Action(() =>
{
this.Close();
}));
}
//LiveClassroom.CallerWindow.Show();//还原调用者窗口
} }
} }
@ -354,7 +260,7 @@ namespace JianGongYun.TRTC.Windows
LiveWindowViewModel.ShowShareScreenList = false; LiveWindowViewModel.ShowShareScreenList = false;
} }
private void ShareList_Selected(object sender, MouseButtonEventArgs e) private void ShareList_Selected(object sender, RoutedEventArgs e)
{ {
CloseShareList_Click(sender, e); CloseShareList_Click(sender, e);
if (LiveWindowViewModel.ScreenRunning) if (LiveWindowViewModel.ScreenRunning)
@ -393,13 +299,11 @@ namespace JianGongYun.TRTC.Windows
private void SetMute_Click(object sender, RoutedEventArgs e) private void SetMute_Click(object sender, RoutedEventArgs e)
{ {
var btn = sender as AduSysButton; LiveClassroom.SetMicMute(null);
var tag = btn.Tag.ToString();
LiveClassroom.SetMicMute(null, tag);
NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel() NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel()
{ {
Title = "提醒", Title = "提醒",
Content = $"{(LiveWindowViewModel.MicMute ? "" : "")}{(tag == "mic" ? "" : "")}静音成功" Content = $"{(LiveWindowViewModel.MicMute ? "" : "")}静音成功"
}); });
} }
@ -427,17 +331,12 @@ namespace JianGongYun.TRTC.Windows
} }
else else
{ {
//if (LiveWindowViewModel.CurrentShareScreen == null)//没选择过窗口需要选一次 if (LiveWindowViewModel.CurrentShareScreen == null)//没选择过窗口需要选一次
//{ {
// LiveWindowViewModel.ShowShareScreenList = true; LiveWindowViewModel.ShowShareScreenList = true;
// this.Dispatcher.Invoke(new Action(() => LiveWindowViewModel.LoadAllScreen()));
//}
//LiveClassroom.StartVideoSub(AfterLiveSubViewWrap);
//直接分享桌面1并收起
this.Dispatcher.Invoke(new Action(() => LiveWindowViewModel.LoadAllScreen())); this.Dispatcher.Invoke(new Action(() => LiveWindowViewModel.LoadAllScreen()));
LiveWindowViewModel.CurrentShareScreen = LiveWindowViewModel.LiveScreens?[0].Info; }
LiveClassroom.StartVideoSub(AfterLiveSubViewWrap); LiveClassroom.StartVideoSub(AfterLiveSubViewWrap);
PackUp_Click(sender, e);
} }
NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel() NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel()
{ {
@ -452,40 +351,5 @@ namespace JianGongYun.TRTC.Windows
this.Hide(); this.Hide();
blockTop.Show(); blockTop.Show();
} }
public void SendMsg(TextBox text)
{
if (!string.IsNullOrEmpty(text.Text))
{
//LiveWindow.LiveWindowViewModel.Chats.Add(new Models.ChatEntity { Body = text.Text });//往Chats集合添加数据会自动更新到界面上
LiveClassroom.WSClient.Send($"{{\"code\":10086,\"mess\":\"{text.Text}\",\"room\":\"push_{LiveClassroom.ClassId}\"}}");
text.Text = "";
}
}
private void Button_PreviewKeyDown(object sender, KeyEventArgs e)
{
//输入框回车
if (e.Key == Key.Enter)
{
SendMsg(ChatIpt);
}
}
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
//输入框回车
if (e.Key == Key.Enter)
{
var text = (TextBox)sender;
SendMsg(text);
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
SendMsg(ChatIpt);
}
} }
} }

View File

@ -4,8 +4,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun.TRTC.Windows" xmlns:local="clr-namespace:JianGongYun.TRTC.Windows"
xmlns:System="clr-namespace:System;assembly=mscorlib"
xmlns:Metro="clr-namespace:AduSkin.Controls.Metro;assembly=AduSkin"
mc:Ignorable="d" mc:Ignorable="d"
ResizeMode="NoResize" ResizeMode="NoResize"
ShowInTaskbar="False" ShowInTaskbar="False"
@ -14,53 +12,9 @@
AllowsTransparency="True" AllowsTransparency="True"
Background="Transparent" Background="Transparent"
MouseDown="Window_MouseDown" MouseDown="Window_MouseDown"
xmlns:live="clr-namespace:JianGongYun.TRTC"
Title="" Height="600" Width="200"> Title="" Height="600" Width="200">
<Window.Resources> <Window.Resources>
<System:Double x:Key="rd">9</System:Double>
<SolidColorBrush x:Key="itembg" Color="#50000000" />
<System:Double x:Key="ipth">35</System:Double>
<System:Double x:Key="far">5</System:Double>
<CornerRadius x:Key="fullrd" TopLeft="{StaticResource rd}" TopRight="{StaticResource rd}" BottomRight="{StaticResource rd}" BottomLeft="{StaticResource rd}"></CornerRadius>
<CornerRadius x:Key="arird" TopLeft="{StaticResource rd}" TopRight="{StaticResource rd}" BottomRight="{StaticResource rd}" BottomLeft="0"></CornerRadius>
<Thickness x:Key="fullfar" Left="{StaticResource far}" Top="{StaticResource far}" Bottom="{StaticResource far}" Right="{StaticResource far}"></Thickness>
<Thickness x:Key="hfar" Left="{StaticResource far}" Right="{StaticResource far}"></Thickness>
<Style x:Key="placeHolder" TargetType="{x:Type TextBox}" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Grid>
<TextBox Margin="0" Padding="{StaticResource hfar}" BorderThickness="0" VerticalContentAlignment="Center" Text="{Binding Path=Text,RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" x:Name="textSource" Background="Transparent" Foreground="White" Panel.ZIndex="2" />
<TextBox Margin="0" Padding="{StaticResource hfar}" BorderThickness="0" VerticalContentAlignment="Center" Text="{TemplateBinding Tag}" Background="{TemplateBinding Background}" Panel.ZIndex="1">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="Transparent"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Text, Source={x:Reference textSource}}" Value="">
<Setter Property="Foreground" Value="#fff"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
<TextBox.Resources>
<Style TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="{StaticResource fullrd}"/>
<Setter Property="BorderBrush" Value="#c1d0dc"/>
</Style>
</TextBox.Resources>
</TextBox>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<BooleanToVisibilityConverter x:Key="VisibilityOfBool" /> <BooleanToVisibilityConverter x:Key="VisibilityOfBool" />
<live:ChatItemBgConverter x:Key="BgByVal" />
<live:UnBooleanToVisibilityConverter x:Key="UnVisibilityOfBool" />
</Window.Resources> </Window.Resources>
<DockPanel> <DockPanel>
<!--预览框--> <!--预览框-->
@ -70,66 +24,9 @@
<TextBlock Foreground="White" FontSize="13" HorizontalAlignment="Center" VerticalAlignment="Center">摄像头未开启</TextBlock> <TextBlock Foreground="White" FontSize="13" HorizontalAlignment="Center" VerticalAlignment="Center">摄像头未开启</TextBlock>
</Grid> </Grid>
<Grid Visibility="{Binding CameraRunning, Converter={StaticResource VisibilityOfBool}}" x:Name="PreVideoWrap" Background="#202020" Width="{Binding ElementName=PreViewWrap,Path=ActualWidth}" Height="{Binding ElementName=PreViewWrap,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"></Grid> <Grid Visibility="{Binding CameraRunning, Converter={StaticResource VisibilityOfBool}}" x:Name="PreVideoWrap" Background="#202020" Width="{Binding ElementName=PreViewWrap,Path=ActualWidth}" Height="{Binding ElementName=PreViewWrap,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0"></Grid>
</Canvas> </Canvas>
</Grid> </Grid>
<!--聊天版面--> <!--聊天版面-->
<Canvas x:Name="ChatWrap"> <Grid Background="#33000000"></Grid>
<Grid Canvas.Left="0" Canvas.Top="0" Background="#01000000" Height="{Binding ElementName=ChatWrap,Path=ActualHeight}" Width="{Binding ElementName=ChatWrap,Path=ActualWidth}">
<DockPanel>
<!--输入框-->
<DockPanel Margin="{StaticResource fullfar}" DockPanel.Dock="Bottom" Height="{StaticResource ipth}">
<TextBox Background="{StaticResource itembg}" Height="{StaticResource ipth}" Padding="{StaticResource fullfar}" Foreground="White" Style="{StaticResource placeHolder}" PreviewKeyDown="TextBox_PreviewKeyDown" Tag="输入"></TextBox>
</DockPanel>
<!--消息列表-->
<local:ScrollingListBox x:Name="ChatList" BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding Chats}" Background="Transparent">
<ListBox.Resources>
<Style TargetType="ScrollViewer" BasedOn="{StaticResource CusScroll}"></Style>
<Style TargetType="local:ScrollingListBox">
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="Border" Padding="{StaticResource fullfar}" Margin="{StaticResource fullfar}" BorderThickness="0" Background="{Binding Path=Body,Converter={StaticResource BgByVal},ConverterParameter={StaticResource itembg}}" CornerRadius="{StaticResource arird}">
<Label x:Name="Label" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12px">
<ContentPresenter></ContentPresenter>
</Label>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="BorderBrush" Value="#efefef"></Setter>
<Setter TargetName="Border" Property="Background" Value="{StaticResource itembg}"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Setter.Value>
</Setter>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<!--自定义ListBox项样式-->
<DataTemplate>
<StackPanel>
<TextBlock Foreground="White" TextWrapping="Wrap" Text="{Binding Path=FullBody,Mode=OneWay}">
</TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</local:ScrollingListBox>
</DockPanel>
</Grid>
<Grid Visibility="{Binding WSConneced, Converter={StaticResource UnVisibilityOfBool}}" Canvas.Left="0" Canvas.Top="0" Height="{Binding ElementName=ChatWrap,Path=ActualHeight}" Width="{Binding ElementName=ChatWrap,Path=ActualWidth}" Background="#aa2a2b30">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<Metro:AduLoading Margin="0,0,0,0" x:Name="ChatConnIcon" SpeedRatio="1" Foreground="White" Type="Lines" IsActived="True" Height="30"/>
<!--<Label FontSize="14" Foreground="#bbbbbb">连接中</Label>-->
</StackPanel>
</Grid>
</Canvas>
</DockPanel> </DockPanel>
</Window> </Window>

View File

@ -2,7 +2,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics;
using System.Text; using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
@ -15,21 +14,6 @@ using System.Windows.Shapes;
namespace JianGongYun.TRTC.Windows namespace JianGongYun.TRTC.Windows
{ {
public class ScrollingListBox : ListBox
{
protected override void OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.NewItems == null) return;
var newItemCount = e.NewItems.Count;
if (newItemCount > 0)
this.ScrollIntoView(e.NewItems[newItemCount - 1]);
base.OnItemsChanged(e);
}
}
/// <summary> /// <summary>
/// LiveWindowRightBottomBlock.xaml 的交互逻辑 /// LiveWindowRightBottomBlock.xaml 的交互逻辑
/// </summary> /// </summary>
@ -55,16 +39,6 @@ namespace JianGongYun.TRTC.Windows
this.Top += 100; this.Top += 100;
Loaded += LiveWindowRightBottomBlock_Loaded; Loaded += LiveWindowRightBottomBlock_Loaded;
} }
Loaded += LiveWindowRightBottomBlock_Loaded1;
}
private void LiveWindowRightBottomBlock_Loaded1(object sender, RoutedEventArgs e)
{
if (ChatList.Items.Count > 0)
{
ChatList.ScrollIntoView(ChatList.Items[ChatList.Items.Count - 1]);
}
} }
private void LiveWindowRightBottomBlock_Loaded(object sender, RoutedEventArgs e) private void LiveWindowRightBottomBlock_Loaded(object sender, RoutedEventArgs e)
@ -81,7 +55,6 @@ namespace JianGongYun.TRTC.Windows
PreVideoWrap.Children.Add(view); PreVideoWrap.Children.Add(view);
view.SetPause(false); view.SetPause(false);
} }
} }
protected override void OnClosing(CancelEventArgs e) protected override void OnClosing(CancelEventArgs e)
@ -103,22 +76,8 @@ namespace JianGongYun.TRTC.Windows
} }
private void Window_MouseDown(object sender, MouseButtonEventArgs e) private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{ {
this.DragMove(); this.DragMove();
} }
} }
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
//输入框回车
if (e.Key == Key.Enter)
{
var text = (TextBox)sender;
LiveWindow.SendMsg(text);
}
}
}
} }

View File

@ -4,7 +4,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun.TRTC.Windows" xmlns:local="clr-namespace:JianGongYun.TRTC.Windows"
xmlns:live="clr-namespace:JianGongYun.TRTC"
ShowInTaskbar="False" ShowInTaskbar="False"
WindowStyle="None" WindowStyle="None"
AllowsTransparency="True" AllowsTransparency="True"
@ -12,40 +11,25 @@
mc:Ignorable="d" mc:Ignorable="d"
Topmost="True" Topmost="True"
Top="0" Top="0"
Title="" Height="40" Width="472" Title="" Height="40" Width="400"
ResizeMode="NoResize" ResizeMode="NoResize"
MouseMove="Window_MouseMove" MouseMove="Window_MouseMove"
MouseLeave="Window_MouseLeave" MouseLeave="Window_MouseLeave"
MouseLeftButtonDown="Window_MouseLeftButtonDown" MouseLeftButtonDown="Window_MouseLeftButtonDown"
MouseLeftButtonUp="Window_MouseLeftButtonUp" MouseLeftButtonUp="Window_MouseLeftButtonUp"
> >
<Window.Resources>
<BooleanToVisibilityConverter x:Key="VisibilityOfBool" />
<live:UnBooleanToVisibilityConverter x:Key="UnVisibilityOfBool" />
</Window.Resources>
<Border Cursor="Hand" CornerRadius="0 0 15 15" Background="#aa000000"> <Border Cursor="Hand" CornerRadius="0 0 15 15" Background="#aa000000">
<DockPanel Margin="10 0" VerticalAlignment="Center"> <DockPanel Margin="10 0" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" Width="72" DockPanel.Dock="Right"> <StackPanel Orientation="Horizontal" Width="72" DockPanel.Dock="Right">
<Button Click="ShowLiveWin_Click" Style="{StaticResource CusIconBtn}" Background="Transparent" BorderThickness="0"> <Button Click="ShowLiveWin_Click" Style="{StaticResource CusIconBtn}" Background="Transparent" BorderThickness="0">
<Button.Content> <Button.Content>
<!--<TextBlock FontSize="13" Margin="20 0 0 0" TextAlignment="Right" Foreground="#97070e">展开教室</TextBlock>--> <TextBlock FontSize="13" Margin="20 0 0 0" TextAlignment="Right" Foreground="#97070e">展开教室</TextBlock>
<TextBlock FontSize="13" Margin="20 0 0 0" TextAlignment="Right" Foreground="#00cc66">展开教室</TextBlock>
</Button.Content>
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Width="72" DockPanel.Dock="Right">
<Button Click="Button_Click" Style="{StaticResource CusIconBtn}" Background="Transparent" BorderThickness="0">
<Button.Content>
<!--<TextBlock FontSize="13" Margin="20 0 0 0" TextAlignment="Right" Foreground="#97070e">展开教室</TextBlock>-->
<TextBlock FontSize="13" Margin="20 0 0 0" TextAlignment="Right" Foreground="#00cc66">画笔</TextBlock>
</Button.Content> </Button.Content>
</Button> </Button>
</StackPanel> </StackPanel>
<StackPanel Width="130" Orientation="Horizontal" DockPanel.Dock="Right"> <StackPanel Width="130" Orientation="Horizontal" DockPanel.Dock="Right">
<Ellipse Visibility="{Binding TRTCConneced, Converter={StaticResource VisibilityOfBool}}" VerticalAlignment="Center" Width="12" Fill="#00cc66" Height="12"></Ellipse> <Ellipse VerticalAlignment="Center" Width="12" Fill="#00cc66" Height="12"></Ellipse>
<TextBlock Visibility="{Binding TRTCConneced, Converter={StaticResource VisibilityOfBool}}" Margin="5 0 0 0" FontSize="13" Foreground="#00cc66">直播中</TextBlock> <TextBlock Margin="5 0 0 0" FontSize="13" Foreground="#00cc66">直播中</TextBlock>
<Ellipse Visibility="{Binding TRTCConneced, Converter={StaticResource UnVisibilityOfBool}}" VerticalAlignment="Center" Width="12" Fill="Red" Height="12"></Ellipse>
<TextBlock Visibility="{Binding TRTCConneced, Converter={StaticResource UnVisibilityOfBool}}" Margin="5 0 0 0" FontSize="13" Foreground="Red">重连中</TextBlock>
<TextBlock Margin="5 0 0 0" FontSize="13" Foreground="White" Text="{Binding LiveTimeCount}"></TextBlock> <TextBlock Margin="5 0 0 0" FontSize="13" Foreground="White" Text="{Binding LiveTimeCount}"></TextBlock>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">

View File

@ -13,7 +13,6 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
using Application = System.Windows.Forms.Application; using Application = System.Windows.Forms.Application;
using MessageBox = System.Windows.MessageBox;
using MouseEventArgs = System.Windows.Input.MouseEventArgs; using MouseEventArgs = System.Windows.Input.MouseEventArgs;
namespace JianGongYun.TRTC.Windows namespace JianGongYun.TRTC.Windows
@ -100,29 +99,5 @@ namespace JianGongYun.TRTC.Windows
{ {
down = false; down = false;
} }
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Dispatcher.Invoke(() =>
{
try
{
var old = Process.GetProcessesByName("Pointofix");
if (old.Length > 0)
{
foreach (var item in old)
{
item.Kill();
}
}
Process prc = new Process { StartInfo = new ProcessStartInfo { FileName = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Pointofix.exe"), CreateNoWindow = false, UseShellExecute = false } };
prc.Start();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提醒");
}
});
}
} }
} }

View File

@ -7,7 +7,7 @@
xmlns:local="clr-namespace:JianGongYun.TRTC.Windows" xmlns:local="clr-namespace:JianGongYun.TRTC.Windows"
mc:Ignorable="d" mc:Ignorable="d"
ResizeMode="NoResize" ResizeMode="NoResize"
Title="设置" Height="380" Width="650" > Title="设置" Height="380" Width="650">
<Metro:MetroWindow.Resources> <Metro:MetroWindow.Resources>
<DataTemplate x:Key="CusHeaderTitle1"> <DataTemplate x:Key="CusHeaderTitle1">
@ -33,22 +33,21 @@
<Metro:AduComboBox ItemsSource="{Binding CameraList,Mode=OneWay}" DisplayMemberPath="Text" SelectedValuePath="Id" SelectedValue="{Binding CurrentCamera,Mode=TwoWay}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}"></Metro:AduComboBox> <Metro:AduComboBox ItemsSource="{Binding CameraList,Mode=OneWay}" DisplayMemberPath="Text" SelectedValuePath="Id" SelectedValue="{Binding CurrentCamera,Mode=TwoWay}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}"></Metro:AduComboBox>
</DockPanel> </DockPanel>
<DockPanel Style="{StaticResource SettingItem}"> <DockPanel Style="{StaticResource SettingItem}">
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 音频来源</TextBlock>
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding AudioSource}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
<ComboBoxItem Content="仅麦克风" Tag="1"/>
<ComboBoxItem Content="仅系统声音" Tag="2" />
<ComboBoxItem Content="麦和系统声音" Tag="3" />
</Metro:AduComboBox>
</DockPanel>
<DockPanel Visibility="{Binding ShowMicSetting}" Style="{StaticResource SettingItem}">
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 麦克风</TextBlock> <TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 麦克风</TextBlock>
<Metro:AduFlatButton Content="检测麦克风" x:Name="MicTestBtn" Click="TestMic" Width="100" DockPanel.Dock="Right" Margin=" 11 0 10 0" Type="info" /> <Metro:AduFlatButton Content="检测麦克风" x:Name="MicTestBtn" Click="TestMic" Width="100" DockPanel.Dock="Right" Margin=" 11 0 10 0" Type="info" />
<Metro:AduComboBox ItemsSource="{Binding MicList,Mode=OneWay}" DisplayMemberPath="Text" SelectedValuePath="Id" SelectedValue="{Binding CurrentMic,Mode=TwoWay}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}"></Metro:AduComboBox> <Metro:AduComboBox ItemsSource="{Binding MicList,Mode=OneWay}" DisplayMemberPath="Text" SelectedValuePath="Id" SelectedValue="{Binding CurrentMic,Mode=TwoWay}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}"></Metro:AduComboBox>
</DockPanel> </DockPanel>
<DockPanel Visibility="{Binding ShowMicSetting}" Style="{StaticResource SettingItem}"> <DockPanel Style="{StaticResource SettingItem}">
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 麦采集音量</TextBlock> <TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 麦采集音量</TextBlock>
<Metro:AduFlatSilder x:Name="Slider1" DecreaseColor="#3e7fff" IncreaseColor="#aaaaaa" Maximum="100" Value="{Binding MicVolume}" Margin="0 0 10 0" Height="17"/> <Metro:AduFlatSilder x:Name="Slider1" DecreaseColor="#3e7fff" IncreaseColor="#aaaaaa" Maximum="100" Value="{Binding MicVolume}" Margin="0 0 10 0" Height="17"/>
</DockPanel> </DockPanel>
<DockPanel Style="{StaticResource SettingItem}">
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 音频来源</TextBlock>
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding AudioSource}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
<ComboBoxItem Content="仅麦克风" Tag="1"/>
<ComboBoxItem Content="麦和系统声音" Tag="2" />
</Metro:AduComboBox>
</DockPanel>
<DockPanel Visibility="{Binding ShowSytemGatherSlider}" Style="{StaticResource SettingItem}"> <DockPanel Visibility="{Binding ShowSytemGatherSlider}" Style="{StaticResource SettingItem}">
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 系统采集音量</TextBlock> <TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 系统采集音量</TextBlock>
<Metro:AduFlatSilder x:Name="Slider2" DecreaseColor="#3e7fff" IncreaseColor="#aaaaaa" Maximum="100" Value="{Binding SytemGatherVolume}" Margin="0 0 10 0" Height="17"/> <Metro:AduFlatSilder x:Name="Slider2" DecreaseColor="#3e7fff" IncreaseColor="#aaaaaa" Maximum="100" Value="{Binding SytemGatherVolume}" Margin="0 0 10 0" Height="17"/>
@ -101,13 +100,6 @@
<ComboBoxItem Content="高级画质" Tag="-profile:v high -level 5.1"/> <ComboBoxItem Content="高级画质" Tag="-profile:v high -level 5.1"/>
</Metro:AduComboBox> </Metro:AduComboBox>
</DockPanel>--> </DockPanel>-->
<DockPanel Style="{StaticResource SettingItem}">
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 本地录制</TextBlock>
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding LocalRecorder}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
<ComboBoxItem Content="关闭" Tag="False" />
<ComboBoxItem Content="开启" Tag="True" />
</Metro:AduComboBox>
</DockPanel>
<DockPanel Style="{StaticResource SettingItem}"> <DockPanel Style="{StaticResource SettingItem}">
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 录制倒计时</TextBlock> <TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 录制倒计时</TextBlock>
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding ScreenRecordingCountdown}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}"> <Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding ScreenRecordingCountdown}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
@ -161,17 +153,17 @@
<DockPanel Style="{StaticResource SettingItem}"> <DockPanel Style="{StaticResource SettingItem}">
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 摄像头画质</TextBlock> <TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 摄像头画质</TextBlock>
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding LiveMainLevel}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}"> <Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding LiveMainLevel}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
<ComboBoxItem Content="低(640x480)" Tag="Low" /> <ComboBoxItem Content="低" Tag="Low" />
<ComboBoxItem Content="中(960x720)" Tag="Mormal"/> <ComboBoxItem Content="中" Tag="Mormal"/>
<ComboBoxItem Content="高(1280x720)" Tag="High"/> <ComboBoxItem Content="高" Tag="High"/>
</Metro:AduComboBox> </Metro:AduComboBox>
</DockPanel> </DockPanel>
<DockPanel Style="{StaticResource SettingItem}"> <DockPanel Style="{StaticResource SettingItem}">
<TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 屏幕分享画质</TextBlock> <TextBlock Style="{StaticResource SettingItemText}" DockPanel.Dock="Left"> 屏幕分享画质</TextBlock>
<Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding LiveSubLevel}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}"> <Metro:AduComboBox Margin="0 0 10 0" SelectedValuePath="Tag" SelectedValue="{Binding LiveSubLevel}" ComBoxItemPanelBackground="{StaticResource ComboBoxBrush}">
<ComboBoxItem Content="低(960x540)" Tag="Low" /> <ComboBoxItem Content="低" Tag="Low" />
<ComboBoxItem Content="中(1280x720)" Tag="Mormal"/> <ComboBoxItem Content="中" Tag="Mormal"/>
<ComboBoxItem Content="高(1920x1080)" Tag="High"/> <ComboBoxItem Content="高" Tag="High"/>
</Metro:AduComboBox> </Metro:AduComboBox>
</DockPanel> </DockPanel>
<!--<DockPanel Style="{StaticResource SettingItem}"> <!--<DockPanel Style="{StaticResource SettingItem}">

View File

@ -29,8 +29,6 @@ namespace JianGongYun.TRTC.Windows
{ {
_Instance = new SettingWindow(); _Instance = new SettingWindow();
} }
_Instance.Icon = App.icon;
//_Instance.Icon = new BitmapImage(new Uri(System.IO.Path.Combine(Environment.CurrentDirectory, "logo.ico"), UriKind.Absolute));
return _Instance; return _Instance;
} }

View File

@ -1,133 +0,0 @@
; Um diese übersetzung zu nutzen, kopieren Sie diese Datei in das Pointofix-Verzeichnis
; und benennen sie die Datei "pointofix_translation.ini".
; Starten Sie dann Pointofix neu.
;
; 复制语言文件到 Pointofix 安装目录
; 并重命名为 "pointofix_translation.ini"
; 重新启动 Pointofix 即可
;
; Mindestvoraussetzung / Minimum requirement:
; Pointofix Version 1.7.2.2015.07.28
; info@pointofix.de
; 翻译:大眼仔~旭Ananwcxu21@126.com
;
[pointofix_translation]
translation_sprachekurz=zh_cn
translation_sprachelang=Chinese
translation_uebersetzer=翻译:大眼仔~旭Ananwcxu21@126.com
translation_datum=20.07.2016
btn_start=开始
btn_fertig=退出
btn_starthint=冻结屏幕并显示工具栏
btn_fertighint=关闭工具栏并显示屏幕
btn_groesse=画笔大小
btn_groesse1=尺寸1
btn_groesse2=尺寸2
btn_groesse3=尺寸3
btn_groesse4=尺寸4
btn_farbe=颜色
btn_transrot=透明红
btn_transgelb=透明黃
btn_transgruen=透明绿
btn_transblau=透明蓝
btn_deckrot=红色
btn_deckgelb=黃色
btn_deckgruen=绿色
btn_deckblau=蓝色
btn_deckweiss=白色
btn_deckschwarz=黑色
btn_stift=画笔
btn_radiergummi=橡皮
btn_linie=线条
btn_pfeil=箭头
btn_doppelpfeil=双箭头
btn_rechteck=矩型
btn_rechteckgefuellt=填充颜色的矩型
btn_ellipse=椭圆
btn_ellipsegefuellt=填充颜色的椭圆
btn_text=文本
btn_haekchen=打勾
btn_kreuz=交叉
btn_bereich=选择区域
btn_lupe=放大镜
btn_zoomansicht=缩放
btn_hineinzoomen=放大
btn_herauszoomen=缩小
btn_rueckgaengig=撤消
btn_loeschen=清除
btn_drucken=打印...
btn_speichern=保存...
btn_zwischenablage=复制到剪贴板
btn_info=信息/设置/帮助
druck_bildschirmdrucken=打印屏幕
druck_positiongroesse=位置及尺寸
druck_druckenbtn=打印
druck_abbrechenbtn=取消
druck_einstellungenbtn=设置...
druck_drucker=打印机
druck_links=左侧
druck_oben=顶部
druck_breite=宽度
druck_hoehe=高度
druck_seitenverhaeltnis=宽度到高度比例
speichern_bildschirmspeichern=保存屏幕
speichern_filter='PNG (*.png)|*.png|JPEG (*.jpg)|*.jpg|Bitmap (*.bmp)|*.bmp|所有文件 (*.*)|*.*'
info_hilfebtn=在线帮助
info_einstellungenbtn=设置...
info_schliessenbtn=关闭
einstellungen_einstellungen=设置
einstellungen_mauszeiger=鼠标指针样式
einstellungen_mauszeigernormal=默认
einstellungen_mauszeigeraus=
einstellungen_startende=设置开始和离开的默认动作
einstellungen_autostart=自动冻结屏幕并打开工具箱
einstellungen_autoende=当按 '关闭' [F9] 时关闭程序
einstellungen_zoomansicht=图像缩放
einstellungen_mausradzoom=利用利用鼠标滚轮缩放缩放
einstellungen_okbtn=确定
einstellungen_abbrechenbtn=取消
;new since version 1.7
btn_email=使用电子邮件发送...
btn_blatt=新建画布
btn_blattaktuell=原始屏幕
btn_blattweiss=白色画布
btn_blattschwarz=黑色画布
btn_blattkariert=方格画布
btn_blattpunktraster=点状网格
btn_blattlinien=记事本
btn_bereichdlg=选择区域...
auswahl_auswahlbereich=己选择区域
auswahl_positiongroesse=位置和大小
auswahl_links=左侧
auswahl_oben=顶部
auswahl_breite=宽度
auswahl_hoehe=高度
auswahl_okbtn=确定
auswahl_abbrechenbtn=取消
auswahl_loeschenbtn=清除
einstellungen_autoscreenshot=自动截图
einstellungen_autoscreenshotfertig=当单击 '完成'时进行屏幕截图
einstellungen_multimonitor=多显示器冻结屏幕
einstellungen_monitorstart=监测那里单击“开始”按钮
einstellungen_monitor1=始终第一个显示器
einstellungen_monitor2=如果存在的话始终第二个显示器
;new since version 1.7.1
einstellungen_ordner=目录
einstellungen_screenshotordner=截图目录:
einstellungen_emailordner=目录用于临时保存电子邮件:
;new since version 1.7.2
einstellungen_buttongroesse=工具按钮大小
einstellungen_buttonbreite=宽度
einstellungen_buttonhoehe=高度
menue_speichern_speichernunter=另存为...
menue_speichern_pngscreenshot=保存为 PNG 到截图文件夹
menue_speichern_jpgscreenshot=保存为 JPG 到截图文件夹
menue_speichern_screenshotoeffnen=打开截图文件夹
menue_email_pngversenden=发送 PNG...
menue_email_jpgversenden=发送 JPG...
menue_email_emailscreenshotoeffnen=打开电子邮件客户端和截图文件夹...

View File

@ -1,133 +0,0 @@
; Um diese übersetzung zu nutzen, kopieren Sie diese Datei in das Pointofix-Verzeichnis
; und benennen sie die Datei "pointofix_translation.ini".
; Starten Sie dann Pointofix neu.
;
; 复制语言文件到 Pointofix 安装目录
; 并重命名为 "pointofix_translation.ini"
; 重新启动 Pointofix 即可
;
; Mindestvoraussetzung / Minimum requirement:
; Pointofix Version 1.7.2.2015.07.28
; info@pointofix.de
; 翻译:大眼仔~旭Ananwcxu21@126.com
;
[pointofix_translation]
translation_sprachekurz=zh_cn
translation_sprachelang=Chinese
translation_uebersetzer=翻译:大眼仔~旭Ananwcxu21@126.com
translation_datum=20.07.2016
btn_start=开始
btn_fertig=退出
btn_starthint=冻结屏幕并显示工具栏
btn_fertighint=关闭工具栏并显示屏幕
btn_groesse=画笔大小
btn_groesse1=尺寸1
btn_groesse2=尺寸2
btn_groesse3=尺寸3
btn_groesse4=尺寸4
btn_farbe=颜色
btn_transrot=透明红
btn_transgelb=透明黃
btn_transgruen=透明绿
btn_transblau=透明蓝
btn_deckrot=红色
btn_deckgelb=黃色
btn_deckgruen=绿色
btn_deckblau=蓝色
btn_deckweiss=白色
btn_deckschwarz=黑色
btn_stift=画笔
btn_radiergummi=橡皮
btn_linie=线条
btn_pfeil=箭头
btn_doppelpfeil=双箭头
btn_rechteck=矩型
btn_rechteckgefuellt=填充颜色的矩型
btn_ellipse=椭圆
btn_ellipsegefuellt=填充颜色的椭圆
btn_text=文本
btn_haekchen=打勾
btn_kreuz=交叉
btn_bereich=选择区域
btn_lupe=放大镜
btn_zoomansicht=缩放
btn_hineinzoomen=放大
btn_herauszoomen=缩小
btn_rueckgaengig=撤消
btn_loeschen=清除
btn_drucken=打印...
btn_speichern=保存...
btn_zwischenablage=复制到剪贴板
btn_info=信息/设置/帮助
druck_bildschirmdrucken=打印屏幕
druck_positiongroesse=位置及尺寸
druck_druckenbtn=打印
druck_abbrechenbtn=取消
druck_einstellungenbtn=设置...
druck_drucker=打印机
druck_links=左侧
druck_oben=顶部
druck_breite=宽度
druck_hoehe=高度
druck_seitenverhaeltnis=宽度到高度比例
speichern_bildschirmspeichern=保存屏幕
speichern_filter='PNG (*.png)|*.png|JPEG (*.jpg)|*.jpg|Bitmap (*.bmp)|*.bmp|所有文件 (*.*)|*.*'
info_hilfebtn=在线帮助
info_einstellungenbtn=设置...
info_schliessenbtn=关闭
einstellungen_einstellungen=设置
einstellungen_mauszeiger=鼠标指针样式
einstellungen_mauszeigernormal=默认
einstellungen_mauszeigeraus=
einstellungen_startende=设置开始和离开的默认动作
einstellungen_autostart=自动冻结屏幕并打开工具箱
einstellungen_autoende=当按 '关闭' [F9] 时关闭程序
einstellungen_zoomansicht=图像缩放
einstellungen_mausradzoom=利用利用鼠标滚轮缩放缩放
einstellungen_okbtn=确定
einstellungen_abbrechenbtn=取消
;new since version 1.7
btn_email=使用电子邮件发送...
btn_blatt=新建画布
btn_blattaktuell=原始屏幕
btn_blattweiss=白色画布
btn_blattschwarz=黑色画布
btn_blattkariert=方格画布
btn_blattpunktraster=点状网格
btn_blattlinien=记事本
btn_bereichdlg=选择区域...
auswahl_auswahlbereich=己选择区域
auswahl_positiongroesse=位置和大小
auswahl_links=左侧
auswahl_oben=顶部
auswahl_breite=宽度
auswahl_hoehe=高度
auswahl_okbtn=确定
auswahl_abbrechenbtn=取消
auswahl_loeschenbtn=清除
einstellungen_autoscreenshot=自动截图
einstellungen_autoscreenshotfertig=当单击 '完成'时进行屏幕截图
einstellungen_multimonitor=多显示器冻结屏幕
einstellungen_monitorstart=监测那里单击“开始”按钮
einstellungen_monitor1=始终第一个显示器
einstellungen_monitor2=如果存在的话始终第二个显示器
;new since version 1.7.1
einstellungen_ordner=目录
einstellungen_screenshotordner=截图目录:
einstellungen_emailordner=目录用于临时保存电子邮件:
;new since version 1.7.2
einstellungen_buttongroesse=工具按钮大小
einstellungen_buttonbreite=宽度
einstellungen_buttonhoehe=高度
menue_speichern_speichernunter=另存为...
menue_speichern_pngscreenshot=保存为 PNG 到截图文件夹
menue_speichern_jpgscreenshot=保存为 JPG 到截图文件夹
menue_speichern_screenshotoeffnen=打开截图文件夹
menue_email_pngversenden=发送 PNG...
menue_email_jpgversenden=发送 JPG...
menue_email_emailscreenshotoeffnen=打开电子邮件客户端和截图文件夹...

View File

@ -0,0 +1,28 @@
using GalaSoft.MvvmLight;
using JianGongYun.Views;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Controls;
namespace JianGongYun.ViewModel
{
public class MainViewModel : ViewModelBase
{
public MainViewModel()
{
}
/// <summary>
/// 实用案例
/// </summary>
private UserControl _TeachingInfo = new TeachingInfo();
public UserControl TeachingInfo
{
get { return _TeachingInfo; }
set { Set(ref _TeachingInfo, value); }
}
}
}

View File

@ -0,0 +1,91 @@
using GalaSoft.MvvmLight;
using JianGongYun.Models;
using JianGongYun.Views;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Data;
namespace JianGongYun.ViewModel.ModuleViewModel
{
public class PracticalCaseViewModel : ViewModelBase
{
public PracticalCaseViewModel()
{
#region
_ControlList = new List<ControlModel>()
{
new ControlModel("Win10菜单", typeof(Window1)),
new ControlModel("Win10菜单cccc", typeof(Window2)),
new ControlModel("教学计划", typeof(TeachingPlan))
};
_AllControl.Source = _ControlList;
_AllControl.View.Culture = new System.Globalization.CultureInfo("zh-CN");
#endregion
}
#region
private IEnumerable<ControlModel> _ControlList;
/// <summary>
/// 所有控件
/// </summary>
public IEnumerable<ControlModel> AllControl
{
get { return _ControlList; }
set { Set(ref _ControlList, value); }
}
private CollectionViewSource _AllControl=new CollectionViewSource();
/// <summary>
/// 所有控件
/// </summary>
public CollectionViewSource AllControlViewSource
{
get { return _AllControl; }
set
{
Set(ref _AllControl, value);
}
}
#endregion
private ControlModel _CurrentShowControl = null;
/// <summary>
/// 当前显示控件
/// </summary>
public ControlModel CurrentShowControl
{
get
{
return _CurrentShowControl;
}
set
{
Set(ref _CurrentShowControl, value);
RaisePropertyChanged("Content");
}
}
/// <summary>
/// 控件显示
/// </summary>
private UserControl _content;
public UserControl Content
{
get
{
if (CurrentShowControl == null)
return null;
return (UserControl)Activator.CreateInstance(CurrentShowControl.Content);
}
set
{
Set(ref _content, value);
}
}
}
}

View File

@ -0,0 +1,50 @@
using CommonServiceLocator;
using GalaSoft.MvvmLight.Ioc;
using System;
using System.Collections.Generic;
using System.Text;
namespace JianGongYun.ViewModel
{
/// <summary>
/// This class contains static references to all the view models in the
/// application and provides an entry point for the bindings.
/// </summary>
public class ViewModelLocator
{
/// <summary>
/// Initializes a new instance of the ViewModelLocator class.
/// </summary>
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
////if (ViewModelBase.IsInDesignModeStatic)
////{
//// // Create design time view services and models
//// SimpleIoc.Default.Register<IDataService, DesignDataService>();
////}
////else
////{
//// // Create run time view services and models
//// SimpleIoc.Default.Register<IDataService, DataService>();
////}
SimpleIoc.Default.Register<MainViewModel>();
}
public MainViewModel Main
{
get
{
return ServiceLocator.Current.GetInstance<MainViewModel>();
}
}
public static void Cleanup()
{
// TODO Clear the ViewModels
}
}
}

View File

@ -6,7 +6,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun.Views" xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d" mc:Ignorable="d"
Title="Login" Height="450" Width="800" > Title="Login" Height="450" Width="800">
<Grid> <Grid>
</Grid> </Grid>

View File

@ -1,6 +1,4 @@
using AduSkin.Controls; using AduSkin.Controls.Metro;
using AduSkin.Controls.Metro;
using JianGongYun.TRTC;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@ -12,8 +10,6 @@ using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Linq;
using System.Web;
namespace JianGongYun.Views namespace JianGongYun.Views
{ {
@ -22,102 +18,13 @@ namespace JianGongYun.Views
/// </summary> /// </summary>
public partial class Login : MetroWindow public partial class Login : MetroWindow
{ {
const string CLASS_HEAD = "--classhead";
const string CLASS_SUB_HEAD = "--classsubhead";
const string TEACHER_ID = "--teacherid";
const string TEACHER_NAME = "--teachername";
const string END_TIME = "endtime";
static string ParamTip { get { return App.GetConfig<string>("paramTip"); } }
public Login() public Login()
{ {
InitializeComponent(); InitializeComponent();
try BorderBrush = new SolidColorBrush(color: Color.FromRgb(42, 43, 48));
{ MainWindow main = new MainWindow();
//this.Icon = new BitmapImage(new Uri("lg.ico", UriKind.Relative)); main.Show();
this.Icon = App.icon; this.Hide();
//this.Icon = new BitmapImage(new Uri(System.IO.Path.Combine(Environment.CurrentDirectory, "logo.ico"), UriKind.Absolute));
string errMsg = "", classHead = default, classSubHead = default, teacherId = default, teacherName = default, endtime = default;
var urltemps = Environment.GetCommandLineArgs();
if (urltemps.Length < 2)
{
errMsg = ParamTip;
goto Skip;
}
var first = urltemps[1];
if (!first.StartsWith("sznykt"))
{
errMsg = ParamTip;
goto Skip;
}
var u = HttpUtility.UrlDecode(first, Encoding.UTF8);
if (u.EndsWith('/'))
{
u = u.Substring(0, u.Length - 1);
}
var args = u.Replace("://", "|").Split("|");
int indexTemp = Array.IndexOf(args, CLASS_HEAD);
if (indexTemp < 0)
{
errMsg = $"{nameof(classHead)} NULL";
goto Skip;
}
classHead = args[indexTemp + 1];
indexTemp = Array.IndexOf(args, CLASS_SUB_HEAD);
if (indexTemp < 0)
{
errMsg = $"{nameof(CLASS_SUB_HEAD)} NULL";
goto Skip;
}
classSubHead = args[indexTemp + 1];
indexTemp = Array.IndexOf(args, TEACHER_ID);
if (indexTemp < 0)
{
errMsg = $"{nameof(TEACHER_ID)} NULL";
goto Skip;
}
teacherId = args[indexTemp + 1];
indexTemp = Array.IndexOf(args, TEACHER_NAME);
if (indexTemp < 0)
{
errMsg = $"{nameof(TEACHER_NAME)} NULL";
goto Skip;
}
teacherName = args[indexTemp + 1];
indexTemp = Array.IndexOf(args, END_TIME);
if (indexTemp < 0)
{
errMsg = $"{nameof(END_TIME)} NULL";
goto Skip;
}
endtime = args[indexTemp + 1];
Skip:
if (!string.IsNullOrWhiteSpace(errMsg))
{
MessageBox.Show(errMsg, "错误", MessageBoxButton.OKCancel, MessageBoxImage.Error);
Environment.Exit(0);
return;
}
LiveClassroom.EnterTheClassroom(Window.GetWindow(this),
new TRTC.Models.ClassroomEntity
{
ClassHead = classHead,
ClassSubHead = classSubHead,
TeacherId = teacherId,
TeacherName = teacherName,
EndTime = string.IsNullOrEmpty(endtime) ? null : new DateTime?(DateTime.Parse(endtime))
});
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "错误", MessageBoxButton.OKCancel, MessageBoxImage.Error);
Environment.Exit(0);
}
} }
} }
} }

View File

@ -0,0 +1,76 @@
<UserControl x:Class="JianGongYun.Views.TeachingInfo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodel="clr-namespace:JianGongYun.ViewModel.ModuleViewModel"
xmlns:Metro="clr-namespace:AduSkin.Controls.Metro;assembly=AduSkin"
xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="900">
<UserControl.DataContext>
<viewmodel:PracticalCaseViewModel/>
</UserControl.DataContext>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Background="#FFF" BorderThickness="0,0,1,0" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Canvas x:Name="CanvasContent">
<ListBox Height="{Binding ElementName=CanvasContent,Path=ActualHeight}" ItemsSource="{Binding AllControlViewSource.View}" BorderThickness="0" Background="#2F3035" SelectedItem="{Binding CurrentShowControl}">
<ListBox.Resources>
<Style TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="Cursor" Value="Hand"/>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Border MinHeight="40" Width="245" Background="#00000000" x:Name="Bd" BorderBrush="#2F3035" BorderThickness="0 1 0 0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Title}" Foreground="White" Margin="20,0" VerticalAlignment="Center" HorizontalAlignment="Left"/>
</Grid>
</Border>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
<Setter TargetName="Bd" Property="Background" Value="#3E7FFF" />
</DataTrigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="Bd" Property="Background" Value="WhiteSmoke" />
</MultiTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<!--测试按钮-->
<Metro:AduFlatButton Content="直播窗口测试弹出" Click="LiveTest_Click" Canvas.Bottom="100" Canvas.Left="77"></Metro:AduFlatButton>
<!--测试按钮结束-->
</Canvas>
</Grid>
</Border>
<Grid Grid.Column="1">
<Border Margin="0" Height="Auto" Width="Auto" CornerRadius="6" >
<Grid>
<Grid.RowDefinitions >
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ContentPresenter Grid.Row="0" Height="Auto" Content="{Binding Content}"/>
</Grid>
</Border>
</Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,38 @@
using JianGongYun.TRTC;
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace JianGongYun.Views
{
/// <summary>
/// TeachingInfo.xaml 的交互逻辑
/// </summary>
public partial class TeachingInfo : UserControl
{
public TeachingInfo()
{
InitializeComponent();
}
private void LiveTest_Click(object sender, RoutedEventArgs e)
{
LiveClassroom.EnterTheClassroom(Window.GetWindow(this),
new TRTC.Models.ClassroomEntity
{
ClassHead = "课程1",
ClassSubHead = "章节1",
TeacherId = "53245345",
TeacherName = "王大锤"
});
}
}
}

View File

@ -0,0 +1,12 @@
<UserControl x:Class="JianGongYun.Views.TeachingPlan"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace JianGongYun.Views
{
/// <summary>
/// TeachingPlan.xaml 的交互逻辑
/// </summary>
public partial class TeachingPlan : UserControl
{
public TeachingPlan()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,14 @@
<UserControl x:Class="JianGongYun.Views.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d">
<Grid Background="Aqua">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<TextBox Grid.Row="0" Text="5r4354545"></TextBox>
</Grid>
</UserControl>

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace JianGongYun.Views
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class Window1 : UserControl
{
public Window1()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,12 @@
<UserControl x:Class="JianGongYun.Views.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:JianGongYun.Views"
mc:Ignorable="d"
>
<Grid>
<TextBox Text="fdfdfdfdfdfdf"></TextBox>
</Grid>
</UserControl>

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace JianGongYun.Views
{
/// <summary>
/// Window1.xaml 的交互逻辑
/// </summary>
public partial class Window2 : UserControl
{
public Window2()
{
InitializeComponent();
}
}
}

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。n
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则删除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
<PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" Unrestricted="true" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- 指示该应用程序可以感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI无需
选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
在其 PubTool.Tool.Config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.PubTool-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 264 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@ -1,62 +0,0 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Websocket.Client;
namespace WSDemo
{
class Program
{
static void Main(string[] args)
{
var exitEvent = new ManualResetEvent(false);
var url = new Uri("wss://web.cqjgjyw.cn/websocket");
using (var client = new WebsocketClient(url))
{
client.ErrorReconnectTimeout = TimeSpan.FromSeconds(10);
client.ReconnectTimeout = TimeSpan.FromSeconds(10);
client.ReconnectionHappened.Subscribe((info) =>
{
Console.WriteLine($"Reconnection happened, type: {info.Type}");
client.Send("{code:10000,nick:\"张三\",\"room\":\"push_1500\"}");
//if (!client.IsRunning)
//{
// client.Reconnect();
//}
});
client.DisconnectionHappened.Subscribe((info) =>
{
Console.WriteLine($"DisconnectionHappened happened, type: {info.Type}, {info.CloseStatusDescription}");
//if (!client.IsRunning)
//{
// client.Reconnect();
//}
});
client.MessageReceived.Subscribe(msg => Console.WriteLine($"Message received: {msg}"));
client.Start();
//Task.Run(() => client.Send("{code:10000,nick:\"张三\",\"room\":\"push_1500\"}"));
Task.Run(() =>
{
while (true)
{
try
{
client.Send($"{{\"code\":10086,\"mess\":\"{Guid.NewGuid()}\",\"room\":\"push_1500\"}}");
client.Send("{code:10016}");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Thread.Sleep(5000);
}
});
exitEvent.WaitOne();
}
}
}
}

View File

@ -1,13 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Websocket.Client" Version="4.3.30" />
</ItemGroup>
</Project>