EquipmentPropMonitor.xaml.cs
1.02 KB
using HHECS.RobotTool.Model;
using HHECS.RobotTool.ViewModel.EquipmentPropVM;
using Microsoft.Extensions.DependencyInjection;
using RobotTool;
using System.Windows;
namespace HHECS.RobotTool.View.EquipmentPropView
{
/// <summary>
/// EquipmentPropMonitor.xaml 的交互逻辑
/// </summary>
public partial class EquipmentPropMonitor : Window
{
private readonly CancellationTokenSource _cancellationTokenSource;
public EquipmentPropMonitor(EquipmentExtend equipment)
{
InitializeComponent();
_cancellationTokenSource = new CancellationTokenSource();
var dataContext = App.Current.Services.GetService<EquipmentPropMonitorVM>()!;
dataContext.Owner = this;
dataContext.InitialData(equipment, _cancellationTokenSource);
this.DataContext = dataContext;
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
_cancellationTokenSource.Cancel();
}
}
}