GenerateStickers.xaml.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using InABox.Configuration;
  2. using InABox.Wpf;
  3. using PRSClasses;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Shapes;
  17. namespace PRSDesktop.Forms
  18. {
  19. /// <summary>
  20. /// Interaction logic for GenerateStickers.xaml
  21. /// </summary>
  22. public partial class GenerateStickers : ThemableWindow
  23. {
  24. WebStickerSettings _settings { get; set; }
  25. public GenerateStickers()
  26. {
  27. InitializeComponent();
  28. _settings = new UserConfiguration<WebStickerSettings>().Load();
  29. }
  30. private void OK_Click(object sender, RoutedEventArgs e)
  31. {
  32. var num = NumberOfStickers.Value;
  33. if(num < 0)
  34. {
  35. MessageBox.Show("Number of Stickers cannot be negative!");
  36. }
  37. else if(num > _settings.MaximumGenerate)
  38. {
  39. MessageBox.Show($"Cannot generate more than {_settings.MaximumGenerate} stickers at a time!");
  40. }
  41. else
  42. {
  43. DialogResult = true;
  44. Close();
  45. }
  46. }
  47. private void Cancel_Click(object sender, RoutedEventArgs e)
  48. {
  49. DialogResult = false;
  50. Close();
  51. }
  52. }
  53. }