IOView.xaml.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 Init(string systemName)
  29. {
  30. (this.DataContext as IOViewModel).ModuleName = systemName;
  31. (this.DataContext as IOViewModel).BuildIoSchema();
  32. }
  33. }
  34. public class DisplayNameConverter : IValueConverter
  35. {
  36. public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
  37. {
  38. if (value is string s1)
  39. {
  40. int idx = s1.IndexOf('_');
  41. return s1.Substring(idx + 1);
  42. }
  43. return value;
  44. }
  45. public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
  46. {
  47. throw new NotImplementedException();
  48. }
  49. }
  50. }