You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
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;
using System.Windows.Threading;
namespace CowOutputClient
{
/// <summary>
/// Interaction logic for AutoCloseWindow.xaml
/// </summary>
public partial class AutoCloseWindow : Window
{
private DispatcherTimer mShowTimer;
private string mInfo;
public AutoCloseWindow(string info)
{
InitializeComponent();
mInfo = info;
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var seconds = ConfigurationManager.AppSettings["ShowSeconds"];
lblInfo.Content = mInfo;
mShowTimer = new DispatcherTimer();
mShowTimer.Tick += new EventHandler(CloseWindow);
mShowTimer.Interval = new TimeSpan(0, 0, 0, int.Parse(seconds), 0);
mShowTimer.Start();
}
public void CloseWindow(object sender, EventArgs e)
{
this.Close();
}
}
}