DispatchConfirmation.xaml.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using InABox.Wpf;
  2. using System;
  3. using System.IO;
  4. using System.Media;
  5. using System.Windows;
  6. using System.Windows.Media;
  7. using System.Windows.Threading;
  8. namespace PRSDesktop
  9. {
  10. /// <summary>
  11. /// Interaction logic for DispatchConfirmation.xaml
  12. /// </summary>
  13. public partial class DispatchConfirmation : ThemableWindow
  14. {
  15. private readonly Stream _Sound;
  16. private DispatcherTimer _Timer;
  17. public DispatchConfirmation(string status, Color color, Stream sound)
  18. {
  19. InitializeComponent();
  20. Background = new SolidColorBrush(color);
  21. Status.Text = status;
  22. _Sound = sound;
  23. }
  24. private void Window_Loaded(object sender, RoutedEventArgs e)
  25. {
  26. var Sound1 = new SoundPlayer(_Sound);
  27. Sound1.Play();
  28. _Timer = new DispatcherTimer();
  29. _Timer.Tick += Timer_Tick;
  30. _Timer.Interval = new TimeSpan(0, 0, 0, 0, 1500);
  31. _Timer.IsEnabled = true;
  32. }
  33. private void Timer_Tick(object sender, EventArgs e)
  34. {
  35. _Timer.IsEnabled = false;
  36. Close();
  37. }
  38. }
  39. }