Updated the existing C# code into a more modern, imperative and top-level statements style. This involves shortening the code by removing unnecessary parts like additional brackets and explicit namespace declarations. It's done to improve clarity and readability.
27 lines
630 B
C#
27 lines
630 B
C#
using Avalonia.Data.Converters;
|
|
using System.Globalization;
|
|
|
|
namespace SPTInstaller.Converters;
|
|
|
|
public class InvertedProgressConverter : IValueConverter
|
|
{
|
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if( value is int progress)
|
|
{
|
|
return 100 - progress;
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if ( value is int invertedProgress)
|
|
{
|
|
return 100 - invertedProgress;
|
|
}
|
|
|
|
return value;
|
|
}
|
|
} |