磁盘提醒

This commit is contained in:
lxmou666 2020-12-29 11:17:17 +08:00
parent 7c87c4fb30
commit 8c98fa10c5
6 changed files with 50 additions and 5 deletions

View File

@ -334,7 +334,7 @@
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="Width" Value="125"></Setter>
<Setter Property="Width" Value="135"></Setter>
<Setter Property="TextAlignment" Value="Left"></Setter>
</Style>

View File

@ -208,6 +208,11 @@ namespace JianGongYun.TRTC
{
liveWinMode.MicRunning = true;
lTRTCCloud.startLocalAudio(settingWindowViewModel.LiveAudioLevel);
if (liveWinMode.IsLive)
{
var pars = new TRTCAudioRecordingParams { filePath = "" };
lTRTCCloud.startAudioRecording(ref pars);
}
}
}
/// <summary>

View File

@ -10,6 +10,7 @@ using System.Windows.Controls;
using JianGongYun.TRTC.Components;
using System.Windows;
using ManageLiteAV;
using System.Windows.Media;
namespace JianGongYun.TRTC.ViewModels
{
@ -420,7 +421,8 @@ namespace JianGongYun.TRTC.ViewModels
storage.SetValue(INI_ROOT_KEY, INI_KEY_SCREEN_RECORDING_DIR, value.ToString());//生成保存本地
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingDir"));
PropertyChanged(this, new PropertyChangedEventArgs("ScreenRecordingDir"));
PropertyChanged(this, new PropertyChangedEventArgs("DiskSize"));
}
}
}
@ -635,6 +637,35 @@ namespace JianGongYun.TRTC.ViewModels
}
#endregion
#region /// <summary>
/// 磁盘剩余空间
/// </summary>
public double DiskSize
{
get
{
var disk = ScreenRecordingDir.Substring(0, 1);
var drive = new System.IO.DriveInfo(disk);
return Math.Round(drive.TotalFreeSpace / 1024d / 1024d / 1024d, 1, MidpointRounding.AwayFromZero);//GB
}
}
public string DiskSizeStr
{
get
{
return DiskSize + "G";
}
}
public Brush DiskTipColor
{
get
{
return DiskSize <= 20 ? Brushes.Orange : Brushes.LawnGreen;
}
}
#endregion
/// <summary>
/// ini文件操作
/// </summary>

View File

@ -72,7 +72,7 @@
<!--下方设置面板-->
<Canvas DockPanel.Dock="Bottom" Height="70" Background="#232428">
<!--设置按钮-->
<Button Click="Setting_Btn_Click" Style="{StaticResource CusIconBtn}" Canvas.Left="27" Canvas.Top="15" Background="Transparent" BorderThickness="0">
<Button Click="Setting_Btn_Click" Visibility="{Binding IsLive, Converter={StaticResource UnVisibilityOfBool}}" Style="{StaticResource CusIconBtn}" Canvas.Left="27" Canvas.Top="15" Background="Transparent" BorderThickness="0">
<Button.Content>
<StackPanel>
<Path Width="18" Height="18" Fill="#aaaaaa" Shape.Stretch="Fill" Data="{StaticResource Icon_Setting}" />

View File

@ -119,6 +119,12 @@ namespace JianGongYun.TRTC.Windows
var start = Convert.ToBoolean(btn.Tag);
if (start)//开始直播
{
if (SettingWindowViewModel.DiskSize <= 20)
{
var res = AduMessageBox.Show("磁盘剩余空间不足,请选择其他磁盘", "提醒");
return;
}
//停止预览
LiveClassroom.StopMic();
LiveClassroom.StopVideoMain(BeforeLiveViewWrap);

View File

@ -7,7 +7,7 @@
xmlns:local="clr-namespace:JianGongYun.TRTC.Windows"
mc:Ignorable="d"
ResizeMode="NoResize"
Title="设置" Height="380" Width="600">
Title="设置" Height="380" Width="650">
<Metro:MetroWindow.Resources>
<DataTemplate x:Key="CusHeaderTitle1">
@ -110,7 +110,10 @@
<Metro:AduFlatButton CornerRadius="0 3 3 0" Content="打开" x:Name="OpenDir" BorderBrush="#3399ff" BorderThickness="1" Click="OpenDir_Click" Width="50" DockPanel.Dock="Right" Margin="0 0 10 0" Type="info" />
<Metro:AduFlatButton CornerRadius="3 0 0 3" Background="Transparent" BorderBrush="#3399ff" BorderThickness="1" Content="更改" x:Name="ChangeDir" Click="ChangeDir_Click" Width="50" DockPanel.Dock="Right" Margin=" 11 0 0 0" Type="info" />
<Border BorderBrush="White" BorderThickness="1" CornerRadius="3">
<TextBlock Cursor="IBeam" TextTrimming="CharacterEllipsis" ForceCursor="True" ToolTip="{Binding ScreenRecordingDir,Mode=OneWay}" Text="{Binding ScreenRecordingDir,Mode=OneWay}" Foreground="White" Padding="5 7"></TextBlock>
<DockPanel>
<TextBlock DockPanel.Dock="Right" TextAlignment="Right" VerticalAlignment="Center" Width="50" FontSize="12" Padding="0 0 7 0" Foreground="{Binding DiskTipColor,Mode=OneWay}" Text="{Binding DiskSizeStr,Mode=OneWay}"></TextBlock>
<TextBlock TextTrimming="CharacterEllipsis" Cursor="IBeam" Background="Transparent" ForceCursor="True" ToolTip="{Binding ScreenRecordingDir,Mode=OneWay}" Text="{Binding ScreenRecordingDir,Mode=OneWay}" Foreground="White" Padding="7"></TextBlock>
</DockPanel>
</Border>
</DockPanel>
</StackPanel>