WaferAssociationSEUnit.xaml.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. using MECF.Framework.Common.DataCenter;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using System.Windows;
  9. using System.Windows.Controls;
  10. using System.Windows.Data;
  11. using System.Windows.Documents;
  12. using System.Windows.Input;
  13. using System.Windows.Media;
  14. using System.Windows.Media.Imaging;
  15. using System.Windows.Navigation;
  16. using System.Windows.Shapes;
  17. using Venus_MainPages.Unity;
  18. namespace Venus_MainPages.Views
  19. {
  20. /// <summary>
  21. /// WaferAssociationSEUnit.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class WaferAssociationSEUnit : UserControl
  24. {
  25. public WaferAssociationSEUnit()
  26. {
  27. InitializeComponent();
  28. }
  29. public WaferAssociationInfo WFInfo
  30. {
  31. get { return (WaferAssociationInfo)GetValue(WFInfoProperty); }
  32. set { SetValue(WFInfoProperty, value); }
  33. }
  34. public static readonly DependencyProperty WFInfoProperty = DependencyProperty.Register("WFInfo", typeof(WaferAssociationSEUnit), typeof(WaferAssociationSEUnit));
  35. public string SequenceName
  36. {
  37. get { return (string)GetValue(SequenceNameProperty); }
  38. set { SetValue(SequenceNameProperty, value); }
  39. }
  40. public static readonly DependencyProperty SequenceNameProperty = DependencyProperty.Register("SequenceName", typeof(string), typeof(WaferAssociationSEUnit));
  41. public int SelectedIndex
  42. {
  43. get { return (int)GetValue(SelectedIndexProperty); }
  44. set { SetValue(SelectedIndexProperty, value); }
  45. }
  46. public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register("SelectedIndex", typeof(int), typeof(WaferAssociationSEUnit), new PropertyMetadata(1));
  47. public bool ButtonIsEnable
  48. {
  49. get { return (bool)GetValue(ButtonIsEnableProperty); }
  50. set { SetValue(ButtonIsEnableProperty, value); }
  51. }
  52. public static readonly DependencyProperty ButtonIsEnableProperty = DependencyProperty.Register("ButtonIsEnable", typeof(bool), typeof(WaferAssociationSEUnit), new PropertyMetadata(true));
  53. private void cb_DropDownOpened(object sender, EventArgs e)
  54. {
  55. cb.ItemsSource = GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "Sequence")).ToList();
  56. }
  57. private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)
  58. {
  59. WFInfo.SequenceName = cb.SelectedValue.ToString();
  60. }
  61. private IEnumerable<string> GetFilesNames(string path)
  62. {
  63. if (Directory.Exists(path))
  64. {
  65. return Directory.GetFiles(path, "*.seq")
  66. .Select(System.IO.Path.GetFileNameWithoutExtension);
  67. }
  68. else
  69. {
  70. return new List<string>();
  71. }
  72. }
  73. private void SelectAllButton_Click(object sender, RoutedEventArgs e)
  74. {
  75. SelectedIndex = 0;
  76. }
  77. private void UnSelectAllButton_Click(object sender, RoutedEventArgs e)
  78. {
  79. SelectedIndex = 1;
  80. }
  81. }
  82. }