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 Owners { get; } = new List(); public List Authorities { 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.Owner = this.comboBoxParticipants.SelectedItem as Participant; if (this.Berth.Owner != null) this.Berth.Owner_Id = this.Berth.Owner.Id; else this.Berth.Owner_Id = null; this.Berth.Authority = this.comboBoxAuthorities.SelectedItem as Participant; if (this.Berth.Authority != null) this.Berth.Authority_Id = this.Berth.Authority.Id; else this.Berth.Authority_Id = null; this.DialogResult = true; this.Close(); } private void Window_Loaded(object sender, RoutedEventArgs e) { this.DataContext = this.Berth; this.comboBoxParticipants.ItemsSource = this.Owners; this.comboBoxAuthorities.ItemsSource = this.Authorities; } private void buttonResetParticipant_Click(object sender, RoutedEventArgs e) { this.comboBoxParticipants.SelectedItem = null; } private void buttonResetAuthority_Click(object sender, RoutedEventArgs e) { this.comboBoxAuthorities.SelectedItem = null; } } }