Files
Shrlalgo.RvKits/ShrlAlgo.Toolkit.Mvvm/Converters/TaskResultConverter.cs

18 lines
484 B
C#

using System.Globalization;
using System.Windows.Data;
namespace ShrlAlgo.Toolkit.Mvvm.Converters;
public class TaskResultConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is Task<string> val && val.IsCompleted ? val.Result : (object)null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}