This commit is contained in:
parent
4fc0d3bff2
commit
29a889e9e0
|
@ -82,6 +82,7 @@ namespace JianGongYun.TRTC
|
||||||
CurrentLiveWindow.Closed += CurrentLiveWindow_Closed;
|
CurrentLiveWindow.Closed += CurrentLiveWindow_Closed;
|
||||||
|
|
||||||
lTRTCCloud = ITRTCCloud.getTRTCShareInstance();//创建TRTC实例
|
lTRTCCloud = ITRTCCloud.getTRTCShareInstance();//创建TRTC实例
|
||||||
|
lTRTCCloud.addCallback(TRTCCloudCallback);//注册回调
|
||||||
var roomPars = new TRTCParams
|
var roomPars = new TRTCParams
|
||||||
{
|
{
|
||||||
sdkAppId = SDKAppID,
|
sdkAppId = SDKAppID,
|
||||||
|
@ -116,7 +117,6 @@ namespace JianGongYun.TRTC
|
||||||
//liveWinMode.LoadAllScreen();
|
//liveWinMode.LoadAllScreen();
|
||||||
_RecoderDir = $"{classroomEntity.ClassHead}_{classroomEntity.ClassSubHead}";
|
_RecoderDir = $"{classroomEntity.ClassHead}_{classroomEntity.ClassSubHead}";
|
||||||
|
|
||||||
lTRTCCloud.addCallback(TRTCCloudCallback);//注册回调
|
|
||||||
|
|
||||||
callerWindow.Hide();//隐藏调用窗口
|
callerWindow.Hide();//隐藏调用窗口
|
||||||
CurrentLiveWindow.Show();
|
CurrentLiveWindow.Show();
|
||||||
|
@ -371,7 +371,7 @@ namespace JianGongYun.TRTC
|
||||||
int runFps = 0;//实时帧
|
int runFps = 0;//实时帧
|
||||||
Timer timer = new Timer((a) =>
|
Timer timer = new Timer((a) =>
|
||||||
{
|
{
|
||||||
Debug.Print($"runFps {runFps}. leavingsMat {mats.Count}.");
|
//Debug.Print($"runFps {runFps}. leavingsMat {mats.Count}.");
|
||||||
Interlocked.Exchange(ref runFps, 0);
|
Interlocked.Exchange(ref runFps, 0);
|
||||||
}, null, 0, 1000);
|
}, null, 0, 1000);
|
||||||
|
|
||||||
|
@ -551,14 +551,6 @@ namespace JianGongYun.TRTC
|
||||||
Process prc = new Process { StartInfo = new ProcessStartInfo { FileName = Path.Combine(Environment.CurrentDirectory, "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();
|
||||||
if (File.Exists(VideoTempPath))
|
|
||||||
{
|
|
||||||
File.Delete(VideoTempPath);
|
|
||||||
}
|
|
||||||
if (File.Exists(AudioTempPath))
|
|
||||||
{
|
|
||||||
File.Delete(AudioTempPath);
|
|
||||||
}
|
|
||||||
CurrentLiveWindow.Dispatcher.Invoke(new Action(() =>
|
CurrentLiveWindow.Dispatcher.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel()
|
NoticeManager.NotifiactionShow.AddNotifiaction(new NotifiactionModel()
|
||||||
|
@ -567,6 +559,27 @@ namespace JianGongYun.TRTC
|
||||||
Content = $"成功保存直播视频,路径:{ResultFilePath}。",
|
Content = $"成功保存直播视频,路径:{ResultFilePath}。",
|
||||||
NotifiactionType = AduSkin.Controls.EnumPromptType.Success
|
NotifiactionType = AduSkin.Controls.EnumPromptType.Success
|
||||||
});
|
});
|
||||||
|
var res= AduMessageBox.ShowYesNoCancel("是否删除音视频源文件?", "提醒", "删除", "保留", "浏览");
|
||||||
|
if (res== MessageBoxResult.Cancel)
|
||||||
|
{
|
||||||
|
var process = new Process
|
||||||
|
{
|
||||||
|
StartInfo = new ProcessStartInfo { FileName = "explorer.exe", Arguments = RecoderDir }
|
||||||
|
};
|
||||||
|
process.Start();
|
||||||
|
process.WaitForExit();
|
||||||
|
}
|
||||||
|
else if (res== MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
if (File.Exists(VideoTempPath))
|
||||||
|
{
|
||||||
|
File.Delete(VideoTempPath);
|
||||||
|
}
|
||||||
|
if (File.Exists(AudioTempPath))
|
||||||
|
{
|
||||||
|
File.Delete(AudioTempPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
Debug.Print("结束写入视频线程");
|
Debug.Print("结束写入视频线程");
|
||||||
}, TaskCreationOptions.LongRunning);
|
}, TaskCreationOptions.LongRunning);
|
||||||
|
|
|
@ -27,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
|
||||||
|
|
|
@ -37,6 +37,12 @@
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</Metro:MetroWindow.Resources>
|
</Metro:MetroWindow.Resources>
|
||||||
|
<Metro:MetroWindow.Menu>
|
||||||
|
<Metro:MetroTitleMenu Visibility="{Binding IsLive, Converter={StaticResource VisibilityOfBool}}" Height="40" HorizontalAlignment="Center">
|
||||||
|
<Metro:MetroTitleMenuItem Header="收起窗口" Click="PackUp_Click">
|
||||||
|
</Metro:MetroTitleMenuItem>
|
||||||
|
</Metro:MetroTitleMenu>
|
||||||
|
</Metro:MetroWindow.Menu>
|
||||||
<Canvas x:Name="Root" Background="Transparent">
|
<Canvas x:Name="Root" Background="Transparent">
|
||||||
<!--父容器填满-->
|
<!--父容器填满-->
|
||||||
<DockPanel Panel.ZIndex="0" Height="{Binding ElementName=Root,Path=ActualHeight}" Width="{Binding ElementName=Root,Path=ActualWidth}">
|
<DockPanel Panel.ZIndex="0" Height="{Binding ElementName=Root,Path=ActualHeight}" Width="{Binding ElementName=Root,Path=ActualWidth}">
|
||||||
|
@ -58,7 +64,7 @@
|
||||||
<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="开始直播" 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="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 VerticalAlignment="Center" Width="10" Fill="LawnGreen" Height="10"></Ellipse>
|
<Ellipse VerticalAlignment="Center" Width="10" Fill="#00cc66" Height="10"></Ellipse>
|
||||||
<TextBlock FontSize="15" Foreground="White" Margin="7 0 0 0">直播中</TextBlock>
|
<TextBlock FontSize="15" Foreground="White" 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>
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace JianGongYun.TRTC.Windows
|
||||||
[DllImport("Kernel32.dll", EntryPoint = "AttachConsole", CharSet = CharSet.Unicode, SetLastError = true)]
|
[DllImport("Kernel32.dll", EntryPoint = "AttachConsole", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
public static extern void AttachConsole(int dwProcessId);
|
public static extern void AttachConsole(int dwProcessId);
|
||||||
|
|
||||||
ViewModels.LiveWindowViewModel LiveWindowViewModel;
|
public ViewModels.LiveWindowViewModel LiveWindowViewModel;
|
||||||
ViewModels.SettingWindowViewModel SettingWindowViewModel;
|
ViewModels.SettingWindowViewModel SettingWindowViewModel;
|
||||||
public LiveWindow()
|
public LiveWindow()
|
||||||
{
|
{
|
||||||
|
@ -344,5 +344,12 @@ namespace JianGongYun.TRTC.Windows
|
||||||
Content = $"{(LiveWindowViewModel.ScreenRunning ? "开启" : "关闭")}屏幕分享成功"
|
Content = $"{(LiveWindowViewModel.ScreenRunning ? "开启" : "关闭")}屏幕分享成功"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PackUp_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var blockTop = new LiveWindowTopBlock(this);
|
||||||
|
this.Hide();
|
||||||
|
blockTop.Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<Window x:Class="JianGongYun.TRTC.Windows.LiveWindowRightBottomBlock"
|
||||||
|
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.TRTC.Windows"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
ShowInTaskbar="False"
|
||||||
|
Topmost="True"
|
||||||
|
WindowStyle="None"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Transparent"
|
||||||
|
MouseDown="Window_MouseDown"
|
||||||
|
Title="" Height="600" Width="200">
|
||||||
|
<Window.Resources>
|
||||||
|
<BooleanToVisibilityConverter x:Key="VisibilityOfBool" />
|
||||||
|
</Window.Resources>
|
||||||
|
<DockPanel>
|
||||||
|
<!--预览框-->
|
||||||
|
<Grid x:Name="PreViewWrap" DockPanel.Dock="Bottom" Height="200" Width="200">
|
||||||
|
<Canvas>
|
||||||
|
<Grid Background="#202020" Width="{Binding ElementName=PreViewWrap,Path=ActualWidth}" Height="{Binding ElementName=PreViewWrap,Path=ActualHeight}" Canvas.Top="0" Canvas.Left="0">
|
||||||
|
<TextBlock Foreground="White" FontSize="13" HorizontalAlignment="Center" VerticalAlignment="Center">摄像头未开启</TextBlock>
|
||||||
|
</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>
|
||||||
|
</Grid>
|
||||||
|
<!--聊天版面-->
|
||||||
|
<Grid Background="#33000000"></Grid>
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
|
@ -0,0 +1,83 @@
|
||||||
|
using JianGongYun.TRTC.Components;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
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.TRTC.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// LiveWindowRightBottomBlock.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class LiveWindowRightBottomBlock : Window
|
||||||
|
{
|
||||||
|
LiveWindow LiveWindow { get; set; }
|
||||||
|
public LiveWindowRightBottomBlock(LiveWindow _liveWindow)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.Left = SystemParameters.WorkArea.Size.Width - this.Width - 20;
|
||||||
|
this.Top = SystemParameters.WorkArea.Size.Height - this.Height - 20;
|
||||||
|
LiveWindow = _liveWindow;
|
||||||
|
DataContext = LiveWindow.LiveWindowViewModel;
|
||||||
|
if (!LiveWindow.LiveWindowViewModel.CameraRunning)//没有开启摄像头
|
||||||
|
{
|
||||||
|
this.Height -= PreViewWrap.Height;
|
||||||
|
this.Top += PreViewWrap.Height;
|
||||||
|
PreViewWrap.Visibility = Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Height -= 100;
|
||||||
|
this.Top += 100;
|
||||||
|
Loaded += LiveWindowRightBottomBlock_Loaded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LiveWindowRightBottomBlock_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//把主窗口的摄像头预览移到悬浮窗
|
||||||
|
if (LiveWindow.AfterLiveViewWrap.Children.Count == 1)
|
||||||
|
{
|
||||||
|
var view = LiveWindow.AfterLiveViewWrap.Children[0] as TXLiteAVVideoView;
|
||||||
|
BindingOperations.ClearBinding(view, TXLiteAVVideoView.WidthProperty);
|
||||||
|
BindingOperations.ClearBinding(view, TXLiteAVVideoView.HeightProperty);
|
||||||
|
view.Width = PreVideoWrap.Width;
|
||||||
|
view.Height = PreVideoWrap.Height;
|
||||||
|
LiveWindow.AfterLiveViewWrap.Children.Remove(view);
|
||||||
|
PreVideoWrap.Children.Add(view);
|
||||||
|
view.SetPause(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnClosing(CancelEventArgs e)
|
||||||
|
{
|
||||||
|
//关闭前还原预览
|
||||||
|
if (PreVideoWrap.Children.Count == 1)
|
||||||
|
{
|
||||||
|
var view = PreVideoWrap.Children[0] as TXLiteAVVideoView;
|
||||||
|
view.SetPause(true);
|
||||||
|
view.Width = LiveWindow.AfterLiveViewWrap.ActualWidth;
|
||||||
|
view.Height = LiveWindow.AfterLiveViewWrap.ActualHeight;
|
||||||
|
view.SetBinding(TXLiteAVVideoView.WidthProperty, new Binding("ActualWidth") { Source = LiveWindow.AfterLiveViewWrap });
|
||||||
|
view.SetBinding(TXLiteAVVideoView.HeightProperty, new Binding("ActualHeight") { Source = LiveWindow.AfterLiveViewWrap });
|
||||||
|
PreVideoWrap.Children.Remove(view);
|
||||||
|
LiveWindow.AfterLiveViewWrap.Children.Add(view);
|
||||||
|
view.SetPause(false);
|
||||||
|
}
|
||||||
|
base.OnClosing(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_MouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
this.DragMove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
<Window x:Class="JianGongYun.TRTC.Windows.LiveWindowTopBlock"
|
||||||
|
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.TRTC.Windows"
|
||||||
|
ShowInTaskbar="False"
|
||||||
|
WindowStyle="None"
|
||||||
|
AllowsTransparency="True"
|
||||||
|
Background="Transparent"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Topmost="True"
|
||||||
|
Top="0"
|
||||||
|
Title="" Height="40" Width="400"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
MouseMove="Window_MouseMove"
|
||||||
|
MouseLeave="Window_MouseLeave"
|
||||||
|
MouseLeftButtonDown="Window_MouseLeftButtonDown"
|
||||||
|
MouseLeftButtonUp="Window_MouseLeftButtonUp"
|
||||||
|
>
|
||||||
|
<Border Cursor="Hand" CornerRadius="0 0 15 15" Background="#aa000000">
|
||||||
|
<DockPanel Margin="10 0" VerticalAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal" Width="72" DockPanel.Dock="Right">
|
||||||
|
<Button Click="ShowLiveWin_Click" Style="{StaticResource CusIconBtn}" Background="Transparent" BorderThickness="0">
|
||||||
|
<Button.Content>
|
||||||
|
<TextBlock FontSize="13" Margin="20 0 0 0" TextAlignment="Right" Foreground="#97070e">展开教室</TextBlock>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Width="130" Orientation="Horizontal" DockPanel.Dock="Right">
|
||||||
|
<Ellipse VerticalAlignment="Center" Width="12" Fill="#00cc66" Height="12"></Ellipse>
|
||||||
|
<TextBlock Margin="5 0 0 0" FontSize="13" Foreground="#00cc66">直播中</TextBlock>
|
||||||
|
<TextBlock Margin="5 0 0 0" FontSize="13" Foreground="White" Text="{Binding LiveTimeCount}"></TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Foreground="White" FontSize="13">当前教室共有:</TextBlock>
|
||||||
|
<TextBlock Foreground="#3d7cf8" FontSize="13" Text="{Binding StudentCount}"></TextBlock>
|
||||||
|
<TextBlock Foreground="White" Margin="3 0 0 0" FontSize="13">人</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
</Window>
|
|
@ -0,0 +1,103 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using Application = System.Windows.Forms.Application;
|
||||||
|
using MouseEventArgs = System.Windows.Input.MouseEventArgs;
|
||||||
|
|
||||||
|
namespace JianGongYun.TRTC.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// LiveWindowTopBlock.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class LiveWindowTopBlock : Window
|
||||||
|
{
|
||||||
|
LiveWindow LiveWindow { get; set; }
|
||||||
|
LiveWindowRightBottomBlock Child;
|
||||||
|
DpiScale dpi;
|
||||||
|
public LiveWindowTopBlock(LiveWindow _liveWindow)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.Left = (SystemParameters.WorkArea.Size.Width - this.Width) / 2;
|
||||||
|
LiveWindow = _liveWindow;
|
||||||
|
DataContext = LiveWindow.LiveWindowViewModel;
|
||||||
|
dpi = VisualTreeHelper.GetDpi(this);
|
||||||
|
|
||||||
|
Child = new LiveWindowRightBottomBlock(_liveWindow);
|
||||||
|
Child.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnClosing(CancelEventArgs e)
|
||||||
|
{
|
||||||
|
Child.Close();
|
||||||
|
base.OnClosing(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ShowLiveWin_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
LiveWindow.Show();
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool down = false;
|
||||||
|
double initX = 0;
|
||||||
|
|
||||||
|
private void Window_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
down = false;
|
||||||
|
}
|
||||||
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
//this.DragMove();
|
||||||
|
initX = System.Windows.Forms.Control.MousePosition.X / dpi.DpiScaleX;
|
||||||
|
down = true;
|
||||||
|
}
|
||||||
|
//自定义拖动
|
||||||
|
private void Window_MouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (!down)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var temp = System.Windows.Forms.Control.MousePosition.X / dpi.DpiScaleX;
|
||||||
|
var res = temp - initX;
|
||||||
|
if (this.Left + res < 0)
|
||||||
|
{
|
||||||
|
this.Dispatcher.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
this.Left = 0;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else if (this.Left + res > SystemParameters.WorkArea.Size.Width - this.ActualWidth)
|
||||||
|
{
|
||||||
|
this.Dispatcher.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
this.Left = (int)SystemParameters.WorkArea.Size.Width - (int)this.ActualWidth;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Dispatcher.Invoke(new Action(() =>
|
||||||
|
{
|
||||||
|
this.Left += res;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
initX = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_MouseLeave(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
down = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -105,6 +105,7 @@ namespace JianGongYun.TRTC.Windows
|
||||||
StartInfo = new ProcessStartInfo { FileName = "explorer.exe", Arguments = mode.ScreenRecordingDir }
|
StartInfo = new ProcessStartInfo { FileName = "explorer.exe", Arguments = mode.ScreenRecordingDir }
|
||||||
};
|
};
|
||||||
process.Start();
|
process.Start();
|
||||||
|
process.WaitForExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue