RecipeIconConverter.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. using MECF.Framework.Common.RecipeCenter;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Data;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Imaging;
  10. namespace CyberX8_Themes.Converters
  11. {
  12. public class RecipeIconConverter : IValueConverter
  13. {
  14. public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  15. {
  16. return ((RecipeNodeType)value==RecipeNodeType.Directory) ? GetBitmap("RecipeFolder.png") : ((RecipeNodeType)value == RecipeNodeType.File) ? GetBitmap("RecipeFile.png") : GetBitmap("Exit.png");
  17. }
  18. private BitmapImage GetBitmap(string name)
  19. {
  20. return new BitmapImage(new Uri($"pack://application:,,,/MECF.Framework.Common;component/Resources/{name}"));
  21. }
  22. public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
  23. {
  24. return null;
  25. }
  26. }
  27. }