UserNameInput.xaml.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 Aitex.UI.RecipeEditor
  14. {
  15. /// <summary>
  16. /// Interaction logic for UserNameInput.xaml
  17. /// </summary>
  18. public partial class UserNameInput : Window
  19. {
  20. public UserNameInput()
  21. {
  22. InitializeComponent();
  23. this.textBox1.Focus();
  24. }
  25. /// <summary>
  26. /// input changed
  27. /// </summary>
  28. /// <param name="sender"></param>
  29. /// <param name="e"></param>
  30. private void textBox1_TextChanged(object sender, TextChangedEventArgs e)
  31. {
  32. TextBox text = (TextBox)sender;
  33. button1.IsEnabled = text.Text.TrimStart().TrimEnd().Length > 0;
  34. }
  35. public string UserName { get; set; }
  36. /// <summary>
  37. /// save name
  38. /// </summary>
  39. /// <param name="sender"></param>
  40. /// <param name="e"></param>
  41. private void button1_Click(object sender, RoutedEventArgs e)
  42. {
  43. UserName = textBox1.Text;
  44. DialogResult = true;
  45. this.Hide();
  46. }
  47. }
  48. }