RecipeInfoEditor.xaml.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Text.RegularExpressions;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Shapes;
  14. namespace Aitex.UI.RecipeEditor.View
  15. {
  16. /// <summary>
  17. /// Interaction logic for RecipeInfoEditor.xaml
  18. /// </summary>
  19. public partial class RecipeInfoEditor : Window
  20. {
  21. //public RecipeHead RecipeHead
  22. //{
  23. // get;
  24. // set;
  25. //}
  26. public RecipeInfoEditor()
  27. {
  28. InitializeComponent();
  29. //comboBox_PressureMode.Items.Add("TV");
  30. //comboBox_PressureMode.Items.Add("N2Flow");
  31. Loaded += new RoutedEventHandler(RecipeInfoEditor_Loaded);
  32. }
  33. void RecipeInfoEditor_Loaded(object sender, RoutedEventArgs e)
  34. {
  35. //DataContext = RecipeHead;
  36. //if (RecipeHead == null)
  37. //{
  38. // pumpingPinState.SelectedIndex = -1;
  39. // ventingPinState.SelectedIndex = -1;
  40. //}
  41. //else
  42. //{
  43. // pumpingPinState.SelectedIndex = RecipeHead.PumpingPinState == "Up" ? 0 : RecipeHead.PumpingPinState == "Down" ? 1 : -1;
  44. // ventingPinState.SelectedIndex = RecipeHead.VentingPinState == "Up" ? 0 : RecipeHead.VentingPinState == "Down" ? 1 : -1;
  45. // pinDownPressure.Text = RecipeHead.PinDownPressure;
  46. //}
  47. }
  48. private void Button_OK_Click(object sender, RoutedEventArgs e)
  49. {
  50. //if (RecipeHead != null)
  51. //{
  52. // RecipeHead.Description = desc.Text;
  53. // RecipeHead.BasePressure = basePressure.Text;
  54. // RecipeHead.PumpDownLimit = pumpDownLimit.Text;
  55. // RecipeHead.PurgeActive = (purgeActive.IsChecked.HasValue && purgeActive.IsChecked.Value) ? "true" : "false";
  56. // RecipeHead.NotToPurgeOrVent = (notToPurgeOrVent.IsChecked.HasValue && notToPurgeOrVent.IsChecked.Value) ? "true" : "false";
  57. // RecipeHead.SubstrateTemp = substrateTemp.Text;
  58. // RecipeHead.PumpingPinState = ((ComboBoxItem)pumpingPinState.SelectedItem).Content.ToString();
  59. // RecipeHead.VentingPinState = ((ComboBoxItem)ventingPinState.SelectedItem).Content.ToString();
  60. // RecipeHead.PinDownPressure = pinDownPressure.Text;
  61. //}
  62. //Close();
  63. }
  64. private void Button_Cancel_Click(object sender, RoutedEventArgs e)
  65. {
  66. Close();
  67. }
  68. private void OnPreviewTextInput(object sender, TextCompositionEventArgs e)
  69. {
  70. e.Handled = !IsTextAllowed(e.Text);
  71. }
  72. private static bool IsTextAllowed(string text)
  73. {
  74. Regex regex = new Regex("[^0-9.-]+"); //regex that matches disallowed text
  75. return !regex.IsMatch(text);
  76. }
  77. }
  78. }