using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace PEP_Tool { /// /// Interaktionslogik für NewVersionMessageBox.xaml /// public partial class NewVersionMessageBox : Window { System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer(); MainWindow mw = MainWindow.main; public NewVersionMessageBox(string Message, int TimeOut, bool onStart) { InitializeComponent(); MainWindow.MessageShown = true; lblMessage.Text = Message; Time = TimeOut; onStartup = onStart; if (!onStartup) this.Height += 50; timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += Timer_Tick; timer.Start(); Properties.Settings.Default.newVersionScreen = true; Properties.Settings.Default.Save(); mw.newVersionCounter.Visibility = Visibility.Visible; } int versionCount = 0; int Time = 0; private void Timer_Tick(object sender, EventArgs e) { versionCount++; btnNewVersionMessageBoxOK.Content = $"OK ({Time - versionCount})"; mw.newVersionCounter.Text = $"Achtung - Noch {Time - versionCount} Sekunden bis das Programm geschlossen wird..."; if (Time - versionCount <= 0) Application.Current.Shutdown(); } bool onStartup = false; private void btnNewVersionMessageBoxOK_Click(object sender, RoutedEventArgs e) { if (onStartup) Application.Current.Shutdown(); else this.Visibility = Visibility.Collapsed; } } }