using MECF.Framework.Common.DataCenter;
using OpenSEMI.Ctrlib.Controls;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using Venus_Core;
using Venus_MainPages.Unity;
namespace Venus_MainPages.Views
{
///
/// WaferAssociationUnit.xaml 的交互逻辑
///
public partial class KeplerWaferAssociationUnit : UserControl
{
public KeplerWaferAssociationUnit()
{
InitializeComponent();
}
public WaferAssociationInfo WAInfo
{
get { return (WaferAssociationInfo)GetValue(WAInfoProperty); }
set { SetValue(WAInfoProperty, value); }
}
public static readonly DependencyProperty WAInfoProperty = DependencyProperty.Register("WAInfo", typeof(WaferAssociationInfo), typeof(KeplerWaferAssociationUnit));
public string SequenceName
{
get { return (string)GetValue(SequenceNameProperty); }
set { SetValue(SequenceNameProperty, value); }
}
public static readonly DependencyProperty SequenceNameProperty = DependencyProperty.Register("SequenceName", typeof(string), typeof(KeplerWaferAssociationUnit));
public string CarrierId
{
get { return (string)GetValue(CarrierIdProperty); }
set { SetValue(CarrierIdProperty, value); }
}
public static readonly DependencyProperty CarrierIdProperty = DependencyProperty.Register("CarrierId", typeof(string), typeof(KeplerWaferAssociationUnit));
public int SelectedIndex
{
get { return (int)GetValue(SelectedIndexProperty); }
set { SetValue(SelectedIndexProperty, value); }
}
public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register("SelectedIndex", typeof(int), typeof(KeplerWaferAssociationUnit),new PropertyMetadata(1));
public string CycleInfo
{
get { return (string)GetValue(CycleInfoProperty); }
set { SetValue(CycleInfoProperty, value); }
}
public static readonly DependencyProperty CycleInfoProperty = DependencyProperty.Register("CycleInfo", typeof(string), typeof(KeplerWaferAssociationUnit));
public bool ButtonIsEnable
{
get { return (bool)GetValue(ButtonIsEnableProperty); }
set { SetValue(ButtonIsEnableProperty, value); }
}
public static readonly DependencyProperty ButtonIsEnableProperty = DependencyProperty.Register("ButtonIsEnable", typeof(bool), typeof(KeplerWaferAssociationUnit), new PropertyMetadata(true));
private void cb_DropDownOpened(object sender, EventArgs e)
{
cb.ItemsSource = GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "Sequence")).ToList();
}
private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
WAInfo.SequenceName = cb.SelectedValue.ToString();
}
//private void preComboBox_DropDownOpened(object sender, EventArgs e)
//{
// List cleanRecipes=new List();
// string installModules = (string)QueryDataClient.Instance.Service.GetConfig("System.InstalledModules");
// if (installModules.Contains("PMA"))
// {
// cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMA","Clean")).ToList());
// }
// if (installModules.Contains("PMB"))
// {
// cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMB", "Clean")).ToList());
// }
// if (installModules.Contains("PMC"))
// {
// cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMC", "Clean")).ToList());
// }
// if (installModules.Contains("PMD"))
// {
// cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMD", "Clean")).ToList());
// }
// cleanRecipes.Add("");
// //preComboBox.ItemsSource = cleanRecipes.Distinct();
//}
//private void preComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
//{
// WAInfo.PreCleanRecipeName= preComboBox.SelectedValue.ToString();
//}
//private void postComboBox_DropDownOpened(object sender, EventArgs e)
//{
// List cleanRecipes = new List();
// string installModules = (string)QueryDataClient.Instance.Service.GetConfig("System.InstalledModules");
// if (installModules.Contains("PMA"))
// {
// cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMA", "Clean")).ToList());
// }
// if (installModules.Contains("PMB"))
// {
// cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMB", "Clean")).ToList());
// }
// if (installModules.Contains("PMC"))
// {
// cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMC", "Clean")).ToList());
// }
// if (installModules.Contains("PMD"))
// {
// cleanRecipes.AddRange(CommonFunction.GetFilesNames(System.IO.Path.Combine(QueryDataClient.Instance.Service.GetData("GetRTPath").ToString(), "Recipes", "PMD", "Clean")).ToList());
// }
// cleanRecipes.Add("");
// //postComboBox.ItemsSource = cleanRecipes.Distinct();
//}
//private void postComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
//{
// //WAInfo.PostCleanRecipeName = postComboBox.SelectedValue.ToString();
//}
private IEnumerable GetFilesNames(string path)
{
if (Directory.Exists(path))
{
return Directory.GetFiles(path, "*.seq")
.Select(System.IO.Path.GetFileNameWithoutExtension);
}
else
{
return new List();
}
}
private void SelectAllButton_Click(object sender, RoutedEventArgs e)
{
SelectedIndex = 0;
}
private void UnSelectAllButton_Click(object sender, RoutedEventArgs e)
{
SelectedIndex = 1;
}
private void IsEnableCycleCheckBox_Unchecked(object sender, RoutedEventArgs e)
{
CycleNumTextbox.IsEnabled = false;
CycleNumTextbox.Text = "1";
WAInfo.CycleNumber = 1;
}
private void IsEnableCycleCheckBox_Checked(object sender, RoutedEventArgs e)
{
CycleNumTextbox.IsEnabled = true;
}
private void Slot_SlotMouseButtonDown(object sender, MouseButtonEventArgs e)
{
VenusGlobalEvents.OnSlotRightClickChanged(sender as Slot);
}
private void Slot_WaferTransferStarted(object sender, DragDropEventArgs e)
{
try
{
VenusGlobalEvents.OnSlotWaferTransfer(e);
}
catch (Exception ex)
{
Trace.WriteLine(ex);
}
}
}
}