Brak opisu

EditINWindow.xaml.cs 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Shapes;
  13. namespace WpfApplication19
  14. {
  15. /// <summary>
  16. /// Interaction logic for EditINWindow.xaml
  17. /// </summary>
  18. public partial class EditINWindow : Window
  19. {
  20. public EditINWindow()
  21. {
  22. InitializeComponent();
  23. var w = (MainWindow)Application.Current.MainWindow;
  24. grainSizeInput.Text = w.inStarGS;
  25. }
  26. private void saveBtn_Click(object sender, RoutedEventArgs e)
  27. {
  28. var w = (MainWindow)Application.Current.MainWindow;
  29. w.inStarGS = grainSizeInput.Text;
  30. this.Close();
  31. }
  32. private void grainSizeInput_PreviewKeyDown(object sender, KeyEventArgs e)
  33. {
  34. if ((e.Key >= Key.D0 && e.Key <= Key.D9) || e.Key == Key.Next || e.Key == Key.Back || e.Key == Key.Delete || e.Key == Key.Left || e.Key == Key.Right)
  35. e.Handled = false;
  36. else e.Handled = true;
  37. }
  38. }
  39. }