mirror of
https://github.com/Tichau/FileConverter.git
synced 2026-11-20 17:42:20 +01:00
28 lines
863 B
C#
28 lines
863 B
C#
// <copyright file="BitrateToString.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>
|
|
|
|
namespace FileConverter.ValueConverters
|
|
{
|
|
using System;
|
|
using System.Globalization;
|
|
using System.Windows.Data;
|
|
|
|
public class BitrateToString : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (!(value is double))
|
|
{
|
|
throw new ArgumentException("The value must be a double value.");
|
|
}
|
|
|
|
double bitrate = (double)value;
|
|
|
|
return $"{bitrate:0} kbit/s";
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
} |