1
0
mirror of synced 2024-11-14 17:33:49 +00:00
PettingZoo/View/MainWindow.xaml.cs

28 lines
680 B
C#

using System;
using System.Windows;
using PettingZoo.ViewModel;
namespace PettingZoo.View
{
public partial class MainWindow
{
public MainWindow(MainViewModel viewModel)
{
WindowStartupLocation = WindowStartupLocation.CenterScreen;
InitializeComponent();
DataContext = viewModel;
Dispatcher.ShutdownStarted += OnDispatcherShutDownStarted;
}
private void OnDispatcherShutDownStarted(object sender, EventArgs e)
{
var disposable = DataContext as IDisposable;
if (!ReferenceEquals(null, disposable))
disposable.Dispose();
}
}
}