public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { WuRemoteCallResult result = value as WuRemoteCallResult; Debug.Assert(targetType == typeof(ImageSource)); string iconName = result == null ? "StatusRun" : result.Success ? "StatusOK" : "StatusError"; return(new BitmapImage(new Uri($"/Images/{iconName}.png", UriKind.RelativeOrAbsolute))); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return("Running..."); } WuRemoteCallResult result = value as WuRemoteCallResult; Debug.Assert(result != null, $"{nameof(value)} should be castable to {typeof(WuRemoteCallResult).Name}"); Debug.Assert(targetType == typeof(string)); return((result.Success)?"OK":"FAILED"); }