add clock
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
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.Threading;
|
||||
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 SafeBagDE70
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ClockUC.xaml
|
||||
/// </summary>
|
||||
public partial class ClockUC : UserControl
|
||||
{
|
||||
private DispatcherTimer _timer;
|
||||
public ClockUC()
|
||||
{
|
||||
InitializeComponent();
|
||||
_timer = new DispatcherTimer()
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(1)
|
||||
};
|
||||
_timer.Tick += Timer_Tick;
|
||||
_timer.Start();
|
||||
}
|
||||
|
||||
private void Timer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
txtTime.Text = DateTime.Now.ToString("HH:mm:ss");
|
||||
txtDate.Text = DateTime.Now.ToString("dd/MM/yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user