IOView.xaml.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. using Venus_MainPages.ViewModels;
  17. namespace Venus_MainPages.Views
  18. {
  19. /// <summary>
  20. /// IOView.xaml 的交互逻辑
  21. /// </summary>
  22. public partial class IOView : UserControl
  23. {
  24. public IOView()
  25. {
  26. InitializeComponent();
  27. }
  28. public void SetSystemName(string systemName)
  29. {
  30. (this.DataContext as IOViewModel).SystemName = systemName;
  31. }
  32. }
  33. public class DisplayNameConverter : IValueConverter
  34. {
  35. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  36. {
  37. if (value is string s1)
  38. {
  39. int idx = s1.IndexOf('_');
  40. return s1.Substring(idx + 1);
  41. }
  42. return value;
  43. }
  44. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  45. {
  46. throw new NotImplementedException();
  47. }
  48. }
  49. }