// // Copyright 2014 Perforce Software Inc. // 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.Navigation; using System.Windows.Shapes; namespace Perforce.View { /// /// Interaction logic for TimedMessageLabel.xaml /// public partial class TimedMessageLabel : UserControl { private System.Windows.Threading.DispatcherTimer timer; public TimedMessageLabel(string msg, double interval) { InitializeComponent(); Message.Content = msg; timer = new System.Windows.Threading.DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(interval); timer.Tick += timer_Tick; } void timer_Tick(object sender, EventArgs e) { ParentDialog.Close(); } private void Dialog_Loaded(object sender, RoutedEventArgs e) { timer.Start(); } public Technewlogic.WpfDialogManagement.Contracts.ICustomContentDialog ParentDialog { get; set; } } }