DebugView.xaml.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using Prism.Ioc;
  2. using System;
  3. using System.Windows.Controls;
  4. using TeamAAS_VP.Models;
  5. using TeamAAS_VP.ViewModels;
  6. namespace TeamAAS_VP.Views
  7. {
  8. /// <summary>
  9. /// Interaction logic for DebugView
  10. /// </summary>
  11. public partial class DebugView : UserControl
  12. {
  13. IContainerProvider _container;
  14. public DebugView(IContainerProvider container)
  15. {
  16. InitializeComponent();
  17. _container = container;
  18. }
  19. private void TreeView_SelectedItemChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<object> e)
  20. {
  21. try
  22. {
  23. // 获取其 DataContext
  24. DebugViewModel viewModel = DataContext as DebugViewModel;
  25. if (e.NewValue is RobotInfo)
  26. {
  27. viewModel.SelectRobot = e.NewValue as RobotInfo;
  28. viewModel.SelectView("robot",null);
  29. }
  30. else if (e.NewValue is FeederInfo)
  31. {
  32. viewModel.SelectFeeder = e.NewValue as FeederInfo;
  33. viewModel.SelectView("feeder", null);
  34. }
  35. else if (e.NewValue is TreeViewItem && ((TreeViewItem)(e.NewValue)).Name== "VisionSolution")
  36. {
  37. viewModel.SelectView("VisionSolution", null);
  38. }
  39. else if (e.NewValue is TreeViewItem && ((TreeViewItem)(e.NewValue)).Name == "InchingControl")
  40. {
  41. viewModel.SelectView("InchingControl", null);
  42. }
  43. else if (e.NewValue is TreeViewItem && ((TreeViewItem)(e.NewValue)).Name == "Script")
  44. {
  45. viewModel.SelectView("ScriptHome", null);
  46. }
  47. else if (e.NewValue is TreeViewItem && ((TreeViewItem)(e.NewValue)).Name == "FeederClear")
  48. {
  49. viewModel.SelectView("FeederClear", null);
  50. }
  51. }
  52. catch (Exception)
  53. {
  54. }
  55. }
  56. }
  57. }