WaferAssociationUnit.xaml.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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.Windows;
  7. using System.Windows.Controls;
  8. using Venus_MainPages.Unity;
  9. namespace Venus_MainPages.Views
  10. {
  11. /// <summary>
  12. /// WaferAssociationUnit.xaml 的交互逻辑
  13. /// </summary>
  14. public partial class WaferAssociationUnit : UserControl
  15. {
  16. public WaferAssociationUnit()
  17. {
  18. InitializeComponent();
  19. }
  20. public WaferAssociationInfo WAInfo
  21. {
  22. get { return (WaferAssociationInfo)GetValue(WAInfoProperty); }
  23. set { SetValue(WAInfoProperty, value); }
  24. }
  25. public static readonly DependencyProperty WAInfoProperty = DependencyProperty.Register("WAInfo", typeof(WaferAssociationInfo), typeof(WaferAssociationUnit));
  26. public string SequenceName
  27. {
  28. get { return (string)GetValue(SequenceNameProperty); }
  29. set { SetValue(SequenceNameProperty, value); }
  30. }
  31. public static readonly DependencyProperty SequenceNameProperty = DependencyProperty.Register("SequenceName", typeof(string), typeof(WaferAssociationUnit));
  32. public int SelectedIndex
  33. {
  34. get { return (int)GetValue(SelectedIndexProperty); }
  35. set { SetValue(SelectedIndexProperty, value); }
  36. }
  37. public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register("SelectedIndex", typeof(int), typeof(WaferAssociationUnit),new PropertyMetadata(1));
  38. private void cb_DropDownOpened(object sender, EventArgs e)
  39. {
  40. cb.ItemsSource=GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "Sequence")).ToList();
  41. }
  42. private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)
  43. {
  44. WAInfo.SequenceName = cb.SelectedValue.ToString();
  45. }
  46. private void preComboBox_DropDownOpened(object sender, EventArgs e)
  47. {
  48. List<string> cleanRecipes=new List<string>();
  49. string installModules = (string)QueryDataClient.Instance.Service.GetConfig("System.InstalledModules");
  50. if (installModules.Contains("PMA"))
  51. {
  52. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMA","Clean")).ToList());
  53. }
  54. if (installModules.Contains("PMB"))
  55. {
  56. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMB", "Clean")).ToList());
  57. }
  58. if (installModules.Contains("PMC"))
  59. {
  60. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMC", "Clean")).ToList());
  61. }
  62. if (installModules.Contains("PMD"))
  63. {
  64. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMD", "Clean")).ToList());
  65. }
  66. cleanRecipes.Add("");
  67. preComboBox.ItemsSource = cleanRecipes.Distinct();
  68. }
  69. private void preComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  70. {
  71. WAInfo.PreCleanRecipeName= preComboBox.SelectedValue.ToString();
  72. }
  73. private void postComboBox_DropDownOpened(object sender, EventArgs e)
  74. {
  75. List<string> cleanRecipes = new List<string>();
  76. string installModules = (string)QueryDataClient.Instance.Service.GetConfig("System.InstalledModules");
  77. if (installModules.Contains("PMA"))
  78. {
  79. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMA", "Clean")).ToList());
  80. }
  81. if (installModules.Contains("PMB"))
  82. {
  83. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMB", "Clean")).ToList());
  84. }
  85. if (installModules.Contains("PMC"))
  86. {
  87. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMC", "Clean")).ToList());
  88. }
  89. if (installModules.Contains("PMD"))
  90. {
  91. cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMD", "Clean")).ToList());
  92. }
  93. cleanRecipes.Add("");
  94. postComboBox.ItemsSource = cleanRecipes.Distinct();
  95. }
  96. private void postComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  97. {
  98. WAInfo.PostCleanRecipeName = postComboBox.SelectedValue.ToString();
  99. }
  100. private IEnumerable<string> GetFilesNames(string path)
  101. {
  102. if (Directory.Exists(path))
  103. {
  104. return Directory.GetFiles(path, "*.seq")
  105. .Select(System.IO.Path.GetFileNameWithoutExtension);
  106. }
  107. else
  108. {
  109. return new List<string>();
  110. }
  111. }
  112. private void SelectAllButton_Click(object sender, RoutedEventArgs e)
  113. {
  114. SelectedIndex = 0;
  115. }
  116. private void UnSelectAllButton_Click(object sender, RoutedEventArgs e)
  117. {
  118. SelectedIndex = 1;
  119. }
  120. }
  121. }