SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
ReloadDialog.xaml.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Windows;
6 using System.Windows.Controls;
7 using System.Windows.Data;
8 using System.Windows.Documents;
9 using System.Windows.Input;
10 using System.Windows.Media;
11 using System.Windows.Media.Imaging;
12 using System.Windows.Shapes;
13 using System.Windows.Threading;
14 
15 namespace SeciUserInterface.Forms
16 {
20  public partial class ReloadDialog : Window
21  {
22  DispatcherTimer _timer = new DispatcherTimer();
23  int time = 30;
24 
25  public ReloadDialog(int delay)
26  {
27  InitializeComponent();
28 
29  time = delay;
30 
31  _timer.Interval = new TimeSpan(0,0,1);
32  _timer.Tick += new EventHandler(_timer_Tick);
33  _timer.Start();
34  }
35 
36  void _timer_Tick(object sender, EventArgs e)
37  {
38  if (--time < 0)
39  {
40  _timer.Stop();
41  DialogResult = true;
42  Close();
43  }
44 
45  txtTime.Text = "The configuration will automatically be reloaded in " + time + " seconds.";
46  }
47 
48  private void Yes_Clicked(object sender, RoutedEventArgs e)
49  {
50  _timer.Stop();
51  DialogResult = true;
52  Close();
53  }
54 
55  private void No_Clicked(object sender, RoutedEventArgs e)
56  {
57  _timer.Stop();
58  DialogResult = false;
59  Close();
60  }
61  }
62 }
Interaction logic for ReloadDialog.xaml
void _timer_Tick(object sender, EventArgs e)
void Yes_Clicked(object sender, RoutedEventArgs e)
void No_Clicked(object sender, RoutedEventArgs e)