1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- 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;
- }
- 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.ElectrodeTemp = electrodeTemp.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);
- }
- }
- }
|