MenuInfoConvert.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using GeekDesk.Constant;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Globalization;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows.Data;
  9. namespace GeekDesk.Converts
  10. {
  11. public class MenuInfoConvert : IValueConverter
  12. {
  13. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  14. {
  15. int menuIndex = MainWindow.appData.AppConfig.SelectedMenuIndex;
  16. if (menuIndex == -1)
  17. {
  18. return "";
  19. } else
  20. {
  21. string type = parameter.ToString();
  22. if ("1".Equals(type))
  23. {
  24. return MainWindow.appData.MenuList[menuIndex].MenuGeometry;
  25. }
  26. else
  27. {
  28. return MainWindow.appData.MenuList[menuIndex].MenuName;
  29. }
  30. }
  31. }
  32. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  33. {
  34. return null;
  35. //bool isChecked = (bool)value;
  36. //if (!isChecked)
  37. //{
  38. // return null;
  39. //}
  40. //return (AppHideType)int.Parse(parameter.ToString());
  41. }
  42. }
  43. }