This is a basic WPF program which displays the data and time so it is readable from a distance -- if needed.
https://www.craigoates.net/Software/project/9
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.
31 lines
901 B
31 lines
901 B
using System; |
|
using System.Windows.Threading; |
|
|
|
namespace DesktopClock |
|
{ |
|
/// <summary> |
|
/// Interaction logic for MainWindow.xaml |
|
/// </summary> |
|
public partial class MainWindow |
|
{ |
|
TimeSpan timer = new TimeSpan(0, 0, 1); |
|
DispatcherTimer updateTimer = new DispatcherTimer(); |
|
|
|
public MainWindow() |
|
{ |
|
InitializeComponent(); |
|
TimeBox.Text = DateTime.Now.ToShortTimeString(); |
|
DateBox.Text = DateTime.Now.ToLongDateString(); |
|
updateTimer.Interval = timer; |
|
updateTimer.Tick += UpdateGUI; |
|
updateTimer.Start(); |
|
} |
|
|
|
private void UpdateGUI(object sender, EventArgs e) |
|
{ |
|
TimeBox.Text = DateTime.Now.ToShortTimeString(); |
|
DateBox.Text = DateTime.Now.ToLongDateString(); |
|
if (updateTimer.IsEnabled) updateTimer.Start(); |
|
} |
|
} |
|
}
|
|
|