| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using Prism.Ioc;
- using System;
- using System.Windows.Controls;
- using TeamAAS_VP.Models;
- using TeamAAS_VP.ViewModels;
- namespace TeamAAS_VP.Views
- {
- /// <summary>
- /// Interaction logic for DebugView
- /// </summary>
- public partial class DebugView : UserControl
- {
- IContainerProvider _container;
- public DebugView(IContainerProvider container)
- {
- InitializeComponent();
- _container = container;
- }
- private void TreeView_SelectedItemChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<object> 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)
- {
- }
- }
- }
- }
|