PageRenderTime 39ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/TEditXna/View/Popups/SignPopup.xaml.cs

https://github.com/Surfpup/Terraria-Map-Editor
C# | 67 lines | 54 code | 7 blank | 6 comment | 5 complexity | 87276e4a242b8b718f77a5ebac99d78b MD5 | raw file
  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.Controls.Primitives;
  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.Navigation;
  14. using System.Windows.Shapes;
  15. using TEditXNA.Terraria;
  16. namespace TEditXna.View.Popups
  17. {
  18. /// <summary>
  19. /// Interaction logic for SignPopup.xaml
  20. /// </summary>
  21. public partial class SignPopup : Popup
  22. {
  23. public SignPopup(Sign sign)
  24. {
  25. InitializeComponent();
  26. DataContext = sign;
  27. }
  28. public void OpenSign(Sign sign)
  29. {
  30. DataContext = sign;
  31. }
  32. private void Popup_MouseDown(object sender, MouseButtonEventArgs e)
  33. {
  34. //IsOpen = false;
  35. }
  36. private void Popup_MouseLeave(object sender, MouseEventArgs e)
  37. {
  38. //IsOpen = false;
  39. }
  40. private void ClosePopup(object sender, RoutedEventArgs e)
  41. {
  42. IsOpen = false;
  43. }
  44. private void ValidateLines(object sender, KeyEventArgs e)
  45. {
  46. // Limit to 10 lines
  47. var tb = sender as TextBox;
  48. if (tb != null)
  49. {
  50. if (e.Key == Key.Enter)
  51. {
  52. if (tb.LineCount > 9)
  53. {
  54. e.Handled = true;
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }