GenerateStickers.xaml.cs 1.5 KB

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