Files
FileConverter/Application/FileConverter/ValueConverters/BitrateToString.cs
T
2020-11-16 21:52:28 +01:00

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();
}
}
}