using Prism.Ioc; using System; using System.Windows.Controls; using TeamAAS_VP.Models; using TeamAAS_VP.ViewModels; namespace TeamAAS_VP.Views { /// /// Interaction logic for DebugView /// public partial class DebugView : UserControl { IContainerProvider _container; public DebugView(IContainerProvider container) { InitializeComponent(); _container = container; } private void TreeView_SelectedItemChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs e) { try { // 获取其 DataContext DebugViewModel viewModel = DataContext as DebugViewModel; if (e.NewValue is RobotInfo) { viewModel.SelectRobot = e.NewValue as RobotInfo; viewModel.SelectView("robot",null); } else if (e.NewValue is FeederInfo) { viewModel.SelectFeeder = e.NewValue as FeederInfo; viewModel.SelectView("feeder", null); } else if (e.NewValue is TreeViewItem && ((TreeViewItem)(e.NewValue)).Name== "VisionSolution") { viewModel.SelectView("VisionSolution", null); } else if (e.NewValue is TreeViewItem && ((TreeViewItem)(e.NewValue)).Name == "InchingControl") { viewModel.SelectView("InchingControl", null); } else if (e.NewValue is TreeViewItem && ((TreeViewItem)(e.NewValue)).Name == "Script") { viewModel.SelectView("ScriptHome", null); } else if (e.NewValue is TreeViewItem && ((TreeViewItem)(e.NewValue)).Name == "FeederClear") { viewModel.SelectView("FeederClear", null); } } catch (Exception) { } } } }