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 { /// /// Interaction logic for RecipeInfoEditor.xaml /// 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; // ventingPinState.SelectedIndex = -1; //} //else //{ // pumpingPinState.SelectedIndex = RecipeHead.PumpingPinState == "Up" ? 0 : RecipeHead.PumpingPinState == "Down" ? 1 : -1; // ventingPinState.SelectedIndex = RecipeHead.VentingPinState == "Up" ? 0 : RecipeHead.VentingPinState == "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.NotToPurgeOrVent = (notToPurgeOrVent.IsChecked.HasValue && notToPurgeOrVent.IsChecked.Value) ? "true" : "false"; // RecipeHead.SubstrateTemp = substrateTemp.Text; // RecipeHead.PumpingPinState = ((ComboBoxItem)pumpingPinState.SelectedItem).Content.ToString(); // RecipeHead.VentingPinState = ((ComboBoxItem)ventingPinState.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); } } }