添加项目文件。
This commit is contained in:
17
Sai.Toolkit.Mvvm/Converters/TaskResultConverter.cs
Normal file
17
Sai.Toolkit.Mvvm/Converters/TaskResultConverter.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Sai.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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user