EquipmentPropMonitor.xaml.cs
1 KB
using HHECS.DAQClient.Model;
using HHECS.DAQClient.ViewModel.EquipmentPropVM;
using Microsoft.Extensions.DependencyInjection;
using System.Windows;
namespace HHECS.DAQClient.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();
}
}
}