using brecal.model;
using System.Collections.Generic;
using System.Windows;
namespace RoleEditor
{
///
/// Interaction logic for EditBerthDialog.xaml
///
public partial class EditBerthDialog : Window
{
public EditBerthDialog()
{
InitializeComponent();
}
public Berth Berth { get; set; } = new Berth();
public List Participants { get; } = new List();
private void buttonCancel_Click(object sender, RoutedEventArgs e)
{
this.DialogResult = false;
this.Close();
}
private void buttonOK_Click(object sender, RoutedEventArgs e)
{
this.Berth.Name = this.textBoxName.Text.Trim();
this.Berth.Lock = this.checkBoxLock.IsChecked;
this.Berth.Participant = this.comboBoxParticipants.SelectedItem as Participant;
if (this.Berth.Participant != null)
this.Berth.Participant_Id = this.Berth.Participant.Id;
else
this.Berth.Participant_Id = null;
this.DialogResult = true;
this.Close();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.DataContext = this.Berth;
this.comboBoxParticipants.ItemsSource = this.Participants;
}
private void buttonResetParticipant_Click(object sender, RoutedEventArgs e)
{
this.comboBoxParticipants.SelectedItem = null;
}
}
}