MenuInfoConvert.cs 1.2 KB

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