12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- 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.Shapes;
- namespace Aitex.UI.RecipeEditor.View
- {
- /// <summary>
- /// Interaction logic for RecipeInfoEditor.xaml
- /// </summary>
- public partial class RecipeInfoEditor : Window
- {
- public RecipeHead RecipeHead
- {
- get;
- set;
- }
- public RecipeInfoEditor()
- {
- InitializeComponent();
- //comboBox_PressureMode.Items.Add("TV");
- //comboBox_PressureMode.Items.Add("N2Flow");
- Loaded += new RoutedEventHandler(RecipeInfoEditor_Loaded);
- }
- void RecipeInfoEditor_Loaded(object sender, RoutedEventArgs e)
- {
- DataContext = RecipeHead;
- if (RecipeHead == null)
- pumpingPinState.SelectedIndex = -1;
- else
- pumpingPinState.SelectedIndex = RecipeHead.PumpingPinState == "Up" ? 0 : RecipeHead.PumpingPinState == "Down" ? 1 : -1;
- if (RecipeHead == null)
- PinStateAfterVent.SelectedIndex = -1;
- else
- {
- PinStateAfterVent.SelectedIndex = RecipeHead.PinStateAfterVent == "Up" ? 0 : RecipeHead.PinStateAfterVent == "Down" ? 1 : -1;
- pinDownPressure.Text = RecipeHead.PinDownPressure;
- }
-
- }
- private void Button_OK_Click(object sender, RoutedEventArgs e)
- {
- if (RecipeHead != null)
- {
- RecipeHead.Description = desc.Text;
- RecipeHead.BasePressure = basePressure.Text;
- RecipeHead.PumpDownLimit = pumpDownLimit.Text;
- RecipeHead.PurgeActive = (purgeActive.IsChecked.HasValue && purgeActive.IsChecked.Value) ? "true" : "false";
- RecipeHead.SubstrateTemp = substrateTemp.Text;
- RecipeHead.PumpingPinState = ((ComboBoxItem)pumpingPinState.SelectedItem).Content.ToString();
- RecipeHead.PinStateAfterVent = ((ComboBoxItem)PinStateAfterVent.SelectedItem).Content.ToString();
- RecipeHead.PinDownPressure = pinDownPressure.Text;
- }
- Close();
- }
- private void Button_Cancel_Click(object sender, RoutedEventArgs e)
- {
- Close();
- }
-
- private void OnPreviewTextInput(object sender, TextCompositionEventArgs e)
- {
- e.Handled = !IsTextAllowed(e.Text);
- }
- private static bool IsTextAllowed(string text)
- {
- Regex regex = new Regex("[^0-9.-]+"); //regex that matches disallowed text
- return !regex.IsMatch(text);
- }
- }
- }
|