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; using System.Windows.Threading; namespace 시계_Gadget { /// /// MainWindow.xaml에 대한 상호 작용 논리 /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Ellipse_MouseDown(object sender, MouseButtonEventArgs e) { DragMove(); } private void Btn_close_Click(object sender, RoutedEventArgs e) { Close(); } private void Window_Loaded(object sender, RoutedEventArgs e) { SetDateTime(); DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += Timer_Tick; timer.Start(); } private void SetDateTime() { tb_date.Text = DateTime.Now.ToShortDateString(); tb_time.Text = DateTime.Now.ToLongTimeString(); } private void Timer_Tick(object sender, EventArgs e) { SetDateTime(); } } }