OptionWindows.xaml.cs 1007 B

12345678910111213141516171819202122232425262728293031323334
  1. using System.Linq;
  2. using System.Windows;
  3. using SHJX.Service.Model.Dao;
  4. using System.Windows.Controls;
  5. using System.Collections.Generic;
  6. using System.Collections.ObjectModel;
  7. namespace SHJX.Service.CustomControl
  8. {
  9. /// <summary>
  10. /// OptionWindows.xaml 的交互逻辑
  11. /// </summary>
  12. public partial class OptionWindows : Window
  13. {
  14. public string WaveKey { get; set; }
  15. public ObservableCollection<string> Wavekeys { get; set; }
  16. public OptionWindows(List<Wavekey> waves)
  17. {
  18. Owner = Application.Current.MainWindow;
  19. DataContext = this;
  20. if (waves.Any())
  21. {
  22. Wavekeys = new ObservableCollection<string>((from wave in waves select wave.WaveKey).ToList());
  23. }
  24. InitializeComponent();
  25. }
  26. private void Button_Click(object sender, RoutedEventArgs e)
  27. {
  28. WaveKey = cmb_wave.SelectedItem?.ToString();
  29. DialogResult = true;
  30. }
  31. }
  32. }