using MECF.Framework.Common.DataCenter;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Venus_MainPages.Unity;
namespace Venus_MainPages.Views
{
///
/// WaferAssociationSEUnit.xaml 的交互逻辑
///
public partial class WaferAssociationSEUnit : UserControl
{
public WaferAssociationSEUnit()
{
InitializeComponent();
}
public WaferAssociationInfo WFInfo
{
get { return (WaferAssociationInfo)GetValue(WFInfoProperty); }
set { SetValue(WFInfoProperty, value); }
}
public static readonly DependencyProperty WFInfoProperty = DependencyProperty.Register("WFInfo", typeof(WaferAssociationSEUnit), typeof(WaferAssociationSEUnit));
public string SequenceName
{
get { return (string)GetValue(SequenceNameProperty); }
set { SetValue(SequenceNameProperty, value); }
}
public static readonly DependencyProperty SequenceNameProperty = DependencyProperty.Register("SequenceName", typeof(string), typeof(WaferAssociationSEUnit));
public int SelectedIndex
{
get { return (int)GetValue(SelectedIndexProperty); }
set { SetValue(SelectedIndexProperty, value); }
}
public static readonly DependencyProperty SelectedIndexProperty = DependencyProperty.Register("SelectedIndex", typeof(int), typeof(WaferAssociationSEUnit), new PropertyMetadata(1));
public bool ButtonIsEnable
{
get { return (bool)GetValue(ButtonIsEnableProperty); }
set { SetValue(ButtonIsEnableProperty, value); }
}
public static readonly DependencyProperty ButtonIsEnableProperty = DependencyProperty.Register("ButtonIsEnable", typeof(bool), typeof(WaferAssociationSEUnit), 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)
{
WFInfo.SequenceName = cb.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;
}
}
}