mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 03:32:20 +08:00
WPF: Update stats display
This commit is contained in:
parent
e6389b2641
commit
e75a29d147
|
@ -26,58 +26,64 @@
|
|||
l:ResxLocalizationProvider.DefaultDictionary="Strings">
|
||||
<MenuItem Header="{l:Loc Global_Copy}" Command="{x:Static m:Commands.Copy}" CommandParameter="{Binding Text}"/>
|
||||
</ContextMenu>
|
||||
<DataTemplate x:Key="RoomCardStatsPopup">
|
||||
<StackPanel l:ResxLocalizationProvider.DefaultDictionary="Strings">
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_SpeedInPercentage"/>
|
||||
<Binding Path="Stats.DuraionRatio" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_CurrentFileDuration"/>
|
||||
<Binding Path="Stats.FileMaxTimestamp" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_TotalFileDuration"/>
|
||||
<Binding Path="Stats.SessionMaxTimestamp" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_SessionDuration"/>
|
||||
<Binding Path="Stats.SessionDuration" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_TotalnputBytes"/>
|
||||
<Binding Path="Stats.TotalInputBytes" Converter="{StaticResource ByteUnitsConverter}" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_TotalOutputBytes"/>
|
||||
<Binding Path="Stats.TotalOutputBytes" Converter="{StaticResource ByteUnitsConverter}" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock Margin="0,5,0,0" Text="{l:Loc RoomCard_Status_SpeedIndicator_Description}"/>
|
||||
</StackPanel>
|
||||
<DataTemplate x:Key="RoomCardStatsPopup"
|
||||
xmlns:core="clr-namespace:BililiveRecorder.Core;assembly=BililiveRecorder.Core"
|
||||
DataType="{x:Type core:Room}">
|
||||
<Grid l:ResxLocalizationProvider.DefaultDictionary="Strings">
|
||||
<TextBlock Visibility="{Binding Stats.DuraionRatio,Converter={StaticResource IsNaNToVisibilityCollapsedConverter}}"
|
||||
TextAlignment="Center" Text="{l:Loc RoomCard_Status_SpeedIndicator_NoData}"/>
|
||||
<StackPanel Visibility="{Binding Stats.DuraionRatio,Converter={StaticResource InvertIsNaNToVisibilityCollapsedConverter}}">
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_SpeedInPercentage"/>
|
||||
<Binding Path="Stats.DuraionRatio" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_CurrentFileDuration"/>
|
||||
<Binding Path="Stats.FileMaxTimestamp" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_TotalFileDuration"/>
|
||||
<Binding Path="Stats.SessionMaxTimestamp" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_SessionDuration"/>
|
||||
<Binding Path="Stats.SessionDuration" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_TotalnputBytes"/>
|
||||
<Binding Path="Stats.TotalInputBytes" Converter="{StaticResource ByteUnitsConverter}" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock>
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{l:StringFormatConverter}">
|
||||
<l:BLoc Key="RoomCard_Status_SpeedIndicator_TotalOutputBytes"/>
|
||||
<Binding Path="Stats.TotalOutputBytes" Converter="{StaticResource ByteUnitsConverter}" Mode="OneWay"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock Margin="0,5,0,0" Text="{l:Loc RoomCard_Status_SpeedIndicator_Description}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="RoomDialogHeader">
|
||||
<StackPanel>
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
<Compile Include="Converters\EnumToBooleanConverter.cs" />
|
||||
<Compile Include="Converters\IsNullToVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\RatioToArrowIconConverter.cs" />
|
||||
<Compile Include="Converters\IsNaNToValueConverter.cs" />
|
||||
<Compile Include="Converters\ShortRoomIdToVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\ValueConverterGroup.cs" />
|
||||
<Compile Include="Models\AboutModel.cs" />
|
||||
|
|
21
BililiveRecorder.WPF/Converters/IsNaNToValueConverter.cs
Normal file
21
BililiveRecorder.WPF/Converters/IsNaNToValueConverter.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace BililiveRecorder.WPF.Converters
|
||||
{
|
||||
public class IsNaNToValueConverter : DependencyObject, IValueConverter
|
||||
{
|
||||
public static readonly DependencyProperty TrueValueProperty = DependencyProperty.Register(nameof(TrueValue), typeof(object), typeof(IsNaNToValueConverter), new PropertyMetadata(null));
|
||||
public static readonly DependencyProperty FalseValueProperty = DependencyProperty.Register(nameof(FalseValue), typeof(object), typeof(IsNaNToValueConverter), new PropertyMetadata(null));
|
||||
|
||||
public object TrueValue { get => this.GetValue(TrueValueProperty); set => this.SetValue(TrueValueProperty, value); }
|
||||
public object FalseValue { get => this.GetValue(FalseValueProperty); set => this.SetValue(FalseValueProperty, value); }
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> (value is double d && double.IsNaN(d)) ? this.TrueValue : this.FalseValue;
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
|
@ -523,6 +523,15 @@ namespace BililiveRecorder.WPF.Properties {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 无统计数据.
|
||||
/// </summary>
|
||||
public static string RoomCard_Status_SpeedIndicator_NoData {
|
||||
get {
|
||||
return ResourceManager.GetString("RoomCard_Status_SpeedIndicator_NoData", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to 录制经过时间: {0:g}.
|
||||
/// </summary>
|
||||
|
|
|
@ -264,6 +264,9 @@
|
|||
正常应为接近 100% 颜色显示为绿色</value>
|
||||
<comment>Shown in tooltip</comment>
|
||||
</data>
|
||||
<data name="RoomCard_Status_SpeedIndicator_NoData" xml:space="preserve">
|
||||
<value>无统计数据</value>
|
||||
</data>
|
||||
<data name="RoomCard_Status_SpeedIndicator_SessionDuration" xml:space="preserve">
|
||||
<value>录制经过时间: {0:g}</value>
|
||||
</data>
|
||||
|
@ -455,9 +458,6 @@ Will use default setting and disable user input when checked.</comment>
|
|||
<data name="TaskbarIconControl_Title" xml:space="preserve">
|
||||
<value>B站录播姬</value>
|
||||
</data>
|
||||
<data name="Toolbox_AutoFix_AnalyzeResult_Stats_AvgFPS" xml:space="preserve">
|
||||
<value>平均FPS {0:F2}</value>
|
||||
</data>
|
||||
<data name="Toolbox_AutoFix_AnalyzeResult_ContainsUnrepairable" xml:space="preserve">
|
||||
<value>文件内存在录播姬无法自动修复的问题
|
||||
请点击 修复失败? 按钮并反馈本问题</value>
|
||||
|
@ -498,6 +498,9 @@ Will use default setting and disable user input when checked.</comment>
|
|||
<data name="Toolbox_AutoFix_AnalyzeResult_Stats_Audio" xml:space="preserve">
|
||||
<value>音频</value>
|
||||
</data>
|
||||
<data name="Toolbox_AutoFix_AnalyzeResult_Stats_AvgFPS" xml:space="preserve">
|
||||
<value>平均FPS {0:F2}</value>
|
||||
</data>
|
||||
<data name="Toolbox_AutoFix_AnalyzeResult_Stats_Disclaimer" xml:space="preserve">
|
||||
<value>仅供参考,有问题的文件的统计可能不准确</value>
|
||||
</data>
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
<c:MultiBoolToValueConverter x:Key="MultiBoolToVisibilityCollapsedConverter" TrueValue="{x:Static Visibility.Visible}" FalseValue="{x:Static Visibility.Collapsed}"/>
|
||||
|
||||
<c:IsNaNToValueConverter x:Key="IsNaNToVisibilityCollapsedConverter" TrueValue="{x:Static Visibility.Visible}" FalseValue="{x:Static Visibility.Collapsed}" />
|
||||
<c:IsNaNToValueConverter x:Key="InvertIsNaNToVisibilityCollapsedConverter" TrueValue="{x:Static Visibility.Collapsed}" FalseValue="{x:Static Visibility.Visible}" />
|
||||
<c:BoolToValueConverter x:Key="BooleanToVisibilityCollapsedConverter" TrueValue="{x:Static Visibility.Visible}" FalseValue="{x:Static Visibility.Collapsed}" />
|
||||
<c:BoolToValueConverter x:Key="InvertBooleanToVisibilityCollapsedConverter" TrueValue="{x:Static Visibility.Collapsed}" FalseValue="{x:Static Visibility.Visible}" />
|
||||
<c:BoolToValueConverter x:Key="BooleanToVisibilityHiddenConverter" TrueValue="{x:Static Visibility.Visible}" FalseValue="{x:Static Visibility.Hidden}" />
|
||||
|
@ -53,6 +55,7 @@
|
|||
<c:IsNullToVisibilityConverter x:Key="IsNullToVisibilityCollapsedConverter"/>
|
||||
<c:RatioToColorBrushConverter x:Key="RatioToColorBrushConverter"/>
|
||||
<c:RatioToArrowIconConverter x:Key="RatioToArrowIconConverter" UpArrow="{StaticResource PathIconDataArrowUpBold}" DownArrow="{StaticResource PathIconDataArrowDownBold}"/>
|
||||
|
||||
<c:ShortRoomIdToVisibilityConverter x:Key="ShortRoomIdToVisibilityConverter"/>
|
||||
<c:ByteUnitsConverter x:Key="ByteUnitsConverter"/>
|
||||
</ResourceDictionary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user