52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
using brecal.model;
|
|
using System.Collections.Generic;
|
|
using System.Windows;
|
|
|
|
namespace RoleEditor
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for EditBerthDialog.xaml
|
|
/// </summary>
|
|
public partial class EditBerthDialog : Window
|
|
{
|
|
public EditBerthDialog()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public Berth Berth { get; set; } = new Berth();
|
|
|
|
public List<Participant> Participants { get; } = new List<Participant>();
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|