2016-06-20 21:22:20 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows;
|
2016-06-18 14:50:32 +00:00
|
|
|
|
using PettingZoo.ViewModel;
|
|
|
|
|
|
|
|
|
|
namespace PettingZoo.View
|
|
|
|
|
{
|
2016-06-20 12:20:37 +00:00
|
|
|
|
public partial class MainWindow
|
2016-06-18 14:50:32 +00:00
|
|
|
|
{
|
2016-06-18 18:30:12 +00:00
|
|
|
|
public MainWindow(MainViewModel viewModel)
|
2016-06-18 14:50:32 +00:00
|
|
|
|
{
|
2016-06-18 18:30:12 +00:00
|
|
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
|
|
|
|
|
2016-06-18 14:50:32 +00:00
|
|
|
|
InitializeComponent();
|
|
|
|
|
DataContext = viewModel;
|
2016-06-20 21:22:20 +00:00
|
|
|
|
|
|
|
|
|
Dispatcher.ShutdownStarted += OnDispatcherShutDownStarted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnDispatcherShutDownStarted(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var disposable = DataContext as IDisposable;
|
|
|
|
|
if (!ReferenceEquals(null, disposable))
|
|
|
|
|
disposable.Dispose();
|
2016-06-18 14:50:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|