WeldMonitorPage.xaml.cs
1.01 KB
using HHECS.RobotTool.Dto;
using HHECS.RobotTool.ViewModel;
using Microsoft.Extensions.DependencyInjection;
using RobotTool;
using System.Windows;
using System.Windows.Controls;
namespace HHECS.RobotTool.View
{
/// <summary>
/// WeldMonitorPage.xaml 的交互逻辑
/// </summary>
public partial class WeldMonitorPage : Page
{
public WeldMonitorPage()
{
InitializeComponent();
var vm = App.Current.Services.GetService<WeldMonitorVM>()!;
DataContext = vm;
}
private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (sender is TreeView tree)
{
if (tree.SelectedItem is EquipmentTreeViewDto dto && dto.Type == 1)
{
if (DataContext is WeldMonitorVM vm)
{
vm.SelectedItemChangedCommand.Execute(dto);
}
}
}
}
}
}