From e75a29d1475c61e91573bc9a8dcefaf5004a3881 Mon Sep 17 00:00:00 2001 From: Genteure Date: Tue, 4 May 2021 15:18:06 +0800 Subject: [PATCH] WPF: Update stats display --- BililiveRecorder.WPF/App.xaml | 110 +++++++++--------- .../BililiveRecorder.WPF.csproj | 1 + .../Converters/IsNaNToValueConverter.cs | 21 ++++ .../Properties/Strings.Designer.cs | 9 ++ BililiveRecorder.WPF/Properties/Strings.resx | 9 +- .../Resources/ConverterResources.xaml | 3 + 6 files changed, 98 insertions(+), 55 deletions(-) create mode 100644 BililiveRecorder.WPF/Converters/IsNaNToValueConverter.cs diff --git a/BililiveRecorder.WPF/App.xaml b/BililiveRecorder.WPF/App.xaml index 76d5573..d72ed35 100644 --- a/BililiveRecorder.WPF/App.xaml +++ b/BililiveRecorder.WPF/App.xaml @@ -26,58 +26,64 @@ l:ResxLocalizationProvider.DefaultDictionary="Strings"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj index ec58233..8b36a55 100644 --- a/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj +++ b/BililiveRecorder.WPF/BililiveRecorder.WPF.csproj @@ -118,6 +118,7 @@ + diff --git a/BililiveRecorder.WPF/Converters/IsNaNToValueConverter.cs b/BililiveRecorder.WPF/Converters/IsNaNToValueConverter.cs new file mode 100644 index 0000000..ef89964 --- /dev/null +++ b/BililiveRecorder.WPF/Converters/IsNaNToValueConverter.cs @@ -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(); + } +} diff --git a/BililiveRecorder.WPF/Properties/Strings.Designer.cs b/BililiveRecorder.WPF/Properties/Strings.Designer.cs index 05551a6..3f8d6bd 100644 --- a/BililiveRecorder.WPF/Properties/Strings.Designer.cs +++ b/BililiveRecorder.WPF/Properties/Strings.Designer.cs @@ -523,6 +523,15 @@ namespace BililiveRecorder.WPF.Properties { } } + /// + /// Looks up a localized string similar to 无统计数据. + /// + public static string RoomCard_Status_SpeedIndicator_NoData { + get { + return ResourceManager.GetString("RoomCard_Status_SpeedIndicator_NoData", resourceCulture); + } + } + /// /// Looks up a localized string similar to 录制经过时间: {0:g}. /// diff --git a/BililiveRecorder.WPF/Properties/Strings.resx b/BililiveRecorder.WPF/Properties/Strings.resx index 700028f..118cb73 100644 --- a/BililiveRecorder.WPF/Properties/Strings.resx +++ b/BililiveRecorder.WPF/Properties/Strings.resx @@ -264,6 +264,9 @@ 正常应为接近 100% 颜色显示为绿色 Shown in tooltip + + 无统计数据 + 录制经过时间: {0:g} @@ -455,9 +458,6 @@ Will use default setting and disable user input when checked. B站录播姬 - - 平均FPS {0:F2} - 文件内存在录播姬无法自动修复的问题 请点击 修复失败? 按钮并反馈本问题 @@ -498,6 +498,9 @@ Will use default setting and disable user input when checked. 音频 + + 平均FPS {0:F2} + 仅供参考,有问题的文件的统计可能不准确 diff --git a/BililiveRecorder.WPF/Resources/ConverterResources.xaml b/BililiveRecorder.WPF/Resources/ConverterResources.xaml index 5f4b58d..f31e4d4 100644 --- a/BililiveRecorder.WPF/Resources/ConverterResources.xaml +++ b/BililiveRecorder.WPF/Resources/ConverterResources.xaml @@ -11,6 +11,8 @@ + + @@ -53,6 +55,7 @@ +