using InABox.Wpf; using System; using System.IO; using System.Media; using System.Windows; using System.Windows.Media; using System.Windows.Threading; namespace PRSDesktop { /// /// Interaction logic for DispatchConfirmation.xaml /// public partial class DispatchConfirmation : ThemableWindow { private readonly Stream _Sound; private DispatcherTimer _Timer; public DispatchConfirmation(string status, Color color, Stream sound) { InitializeComponent(); Background = new SolidColorBrush(color); Status.Text = status; _Sound = sound; } private void Window_Loaded(object sender, RoutedEventArgs e) { var Sound1 = new SoundPlayer(_Sound); Sound1.Play(); _Timer = new DispatcherTimer(); _Timer.Tick += Timer_Tick; _Timer.Interval = new TimeSpan(0, 0, 0, 0, 1500); _Timer.IsEnabled = true; } private void Timer_Tick(object sender, EventArgs e) { _Timer.IsEnabled = false; Close(); } } }