1
0
mirror of synced 2024-11-14 17:33:49 +00:00
PettingZoo/View/ConnectionWindow.xaml.cs
2016-06-18 20:30:12 +02:00

36 lines
870 B
C#

using System.Windows;
using PettingZoo.Model;
using PettingZoo.ViewModel;
namespace PettingZoo.View
{
public class WindowConnectionInfoBuilder : IConnectionInfoBuilder
{
public ConnectionInfo Build()
{
var viewModel = new ConnectionViewModel();
var dialog = new ConnectionWindow(viewModel)
{
Owner = Application.Current.MainWindow
};
if (!dialog.ShowDialog().GetValueOrDefault())
return null;
return viewModel.ConnectionInfo;
}
}
public partial class ConnectionWindow : Window
{
public ConnectionWindow(ConnectionViewModel viewModel)
{
WindowStartupLocation = WindowStartupLocation.CenterOwner;
InitializeComponent();
DataContext = viewModel;
}
}
}