| 1 | // Copyright (C) Microsoft Corporation. All rights reserved. |
| 2 | |
| 3 | namespace WslSettings.Converters |
| 4 | { |
| 5 | public sealed class MegabyteStringConverter : Microsoft.UI.Xaml.Data.IValueConverter |
| 6 | { |
| 7 | public object? Convert(object value, Type targetType, object parameter, string language) |
| 8 | { |
| 9 | if (value == null) |
| 10 | { |
| 11 | return null; |
| 12 | } |
| 13 | |
| 14 | return string.Format("Settings_MegabyteStringFormat".GetLocalized(), (System.Convert.ToUInt64(value) / Constants.MB)); |
| 15 | } |
| 16 | |
| 17 | public object ConvertBack(object value, Type targetType, object parameter, string language) |
| 18 | { |
| 19 | throw new NotImplementedException(); |
| 20 | } |
| 21 | } |
| 22 | } |