123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- using Aitex.Core.Util;
- using System;
- using System.Collections.Generic;
- 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.Sequence;
- using Venus_Unity;
- namespace Venus_MainPages.Views
- {
- /// <summary>
- /// VenusRecipeSequenceSelectView.xaml 的交互逻辑
- /// </summary>
- public partial class VenusRecipeSequenceSelectView : Window
- {
- private FileNode pre_currentFileNode;
- private FileNode process_currentFileNode;
- private FileNode wtw_currentFileNode;
- private FileNode post_currentFileNode;
- private FileNode clean_currentFileNode;
- SerializableDictionary<string, string> recipeDictionary = new SerializableDictionary<string, string>();
- public string FullPath { get; private set; }
- string value;
- public VenusRecipeSequenceSelectView(string path)
- {
- InitializeComponent();
- value = path;
- }
- private void buttonCancel_Click(object sender, RoutedEventArgs e)
- {
- this.DialogResult = false;
- }
- private void buttonOK_Click(object sender, RoutedEventArgs e)
- {
- this.DialogResult = true;
- if (pre_currentFileNode != null && pre_currentFileNode.Parent.Name == "Clean")
- {
- recipeDictionary.Add("PreLotClean", pre_currentFileNode.Name);
- }
- else
- {
- recipeDictionary.Add("PreLotClean", "");
- }
- if (process_currentFileNode != null && process_currentFileNode.Parent.Name == "Process")
- {
- recipeDictionary.Add("Process", process_currentFileNode.Name);
- }
- else
- {
- recipeDictionary.Add("Process", "");
- }
- if (wtw_currentFileNode != null && wtw_currentFileNode.Parent.Name == "Clean")
- {
- recipeDictionary.Add("WTWClean", wtw_currentFileNode.Name);
- recipeDictionary.Add("WTWInterval", WTWInterval.Text);
- }
- else
- {
- recipeDictionary.Add("WTWClean", "");
- recipeDictionary.Add("WTWInterval", "");
- }
- if (post_currentFileNode != null && post_currentFileNode.Parent.Name == "Clean")
- {
- recipeDictionary.Add("PostLotClean", post_currentFileNode.Name);
- }
- else
- {
- recipeDictionary.Add("PostLotClean", "");
- }
- if (clean_currentFileNode != null && clean_currentFileNode.Parent.Name == "Clean")
- {
- recipeDictionary.Add("IdleClean", clean_currentFileNode.Name);
- recipeDictionary.Add("IdleTime", IdleTime.Text);
- }
- else
- {
- recipeDictionary.Add("IdleClean", "");
- recipeDictionary.Add("IdleTime", "");
- }
-
- this.FullPath = SerializeHelper.Instance.DictionaryToString(recipeDictionary);
- }
- private void PreClean_PART_TREE_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
- {
- pre_currentFileNode = (FileNode)(sender as TreeView).SelectedItem;
- if (pre_currentFileNode.Parent.Name == "Clean")
- {
- preLotSelectedRecipeTextBlock.Text = pre_currentFileNode.Name;
- }
- else
- {
- preLotSelectedRecipeTextBlock.Text = "";
- }
- }
- private void Process_PART_TREE_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
- {
- process_currentFileNode = (FileNode)(sender as TreeView).SelectedItem;
- if (process_currentFileNode.Parent.Name == "Process")
- {
- processSelectedRecipeTextBlock.Text = process_currentFileNode.Name;
- }
- else
- {
- processSelectedRecipeTextBlock.Text = "";
- }
- }
- private void WTWClean_PART_TREE_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
- {
- wtw_currentFileNode = (FileNode)(sender as TreeView).SelectedItem;
- if (wtw_currentFileNode.Parent.Name == "Clean")
- {
- wtwSelectedRecipeTextBlock.Text = wtw_currentFileNode.Name;
- }
- else
- {
- wtwSelectedRecipeTextBlock.Text = "";
- }
- }
- private void PostClean_PART_TREE_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
- {
- post_currentFileNode = (FileNode)(sender as TreeView).SelectedItem;
- if (post_currentFileNode.Parent.Name == "Clean")
- {
- postLotSelectedRecipeTextBlock.Text = post_currentFileNode.Name;
- }
- else
- {
- postLotSelectedRecipeTextBlock.Text = "";
- }
- }
- private void IdleClean_PART_TREE_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
- {
- clean_currentFileNode = (FileNode)(sender as TreeView).SelectedItem;
- if (clean_currentFileNode.Parent.Name == "Clean")
- {
- idleLotSelectedRecipeTextBlock.Text = clean_currentFileNode.Name;
- }
- else
- {
- idleLotSelectedRecipeTextBlock.Text = "";
- }
- }
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- var dictionary = SerializeHelper.Instance.StringToDictionary(value);
- if (dictionary.Keys.Contains("PreLotClean"))
- {
- preLotSelectedRecipeTextBlock.Text = dictionary["PreLotClean"];
- foreach (var item in PreLotTreeView.Items)
- {
- var tvi = (TreeViewItem)PreLotTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, dictionary["PreLotClean"]);
- }
- }
- if (dictionary.Keys.Contains("Process"))
- {
- processSelectedRecipeTextBlock.Text = dictionary["Process"];
- foreach (var item in ProcessTreeView.Items)
- {
- var tvi = (TreeViewItem)ProcessTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, dictionary["Process"]);
- }
- }
- if (dictionary.Keys.Contains("WTWClean"))
- {
- wtwSelectedRecipeTextBlock.Text = dictionary["WTWClean"];
- foreach (var item in WTWTreeView.Items)
- {
- var tvi = (TreeViewItem)WTWTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, dictionary["WTWClean"]);
- }
- }
- if (dictionary.Keys.Contains("PostLotClean"))
- {
- postLotSelectedRecipeTextBlock.Text = dictionary["PostLotClean"];
- foreach (var item in PostLotTreeView.Items)
- {
- var tvi = (TreeViewItem)PostLotTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, dictionary["PostLotClean"]);
- }
- }
- if (dictionary.Keys.Contains("IdleClean"))
- {
- idleLotSelectedRecipeTextBlock.Text = dictionary["IdleClean"];
- foreach (var item in LongIdleCleanTreeView.Items)
- {
- var tvi = (TreeViewItem)LongIdleCleanTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, dictionary["IdleClean"]);
- }
- }
- if (dictionary.Keys.Contains("IdleTime"))
- {
- IdleTime.Text = dictionary["IdleTime"];
- }
- if (dictionary.Keys.Contains("WTWInterval"))
- {
- WTWInterval.Text = dictionary["WTWInterval"];
- }
- }
- void SetSelect(TreeViewItem tvi, string value)
- {
- if (tvi.Items.Count > 0)
- {
- foreach (var item in tvi.Items)
- {
- var tviChild = (TreeViewItem)tvi.ItemContainerGenerator.ContainerFromItem(item);
- var model = (FileNode)item;
- if (model.Name == value)
- {
- tviChild.IsSelected = true;
- break;
- }
- else
- {
- SetSelect(tviChild, value);
- }
- }
- }
- }
- private void PreLotBorder_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- foreach (var item in PreLotTreeView.Items)
- {
- var tvi = (TreeViewItem)PreLotTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, "");
- }
- }
- private void ProcessBorder_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- foreach (var item in ProcessTreeView.Items)
- {
- var tvi = (TreeViewItem)ProcessTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, "");
- }
- }
- private void WTWBorder_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- foreach (var item in WTWTreeView.Items)
- {
- var tvi = (TreeViewItem)WTWTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, "");
- }
- }
- private void PostLotBorder_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- foreach (var item in PostLotTreeView.Items)
- {
- var tvi = (TreeViewItem)PostLotTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, "");
- }
- }
- private void IdleBorder_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- foreach (var item in LongIdleCleanTreeView.Items)
- {
- var tvi = (TreeViewItem)LongIdleCleanTreeView.ItemContainerGenerator.ContainerFromItem(item);
- SetSelect(tvi, "");
- }
- }
- }
- }
|