|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- 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 BPASmartClient.CustomResource.UserControls
- {
- /// <summary>
- /// DateTimeUI.xaml 的交互逻辑
- /// </summary>
- public partial class DateTimeUI : UserControl
- {
-
- public DateTimeUI()
- {
- InitializeComponent();
- Task.Run(new Action(() =>
- {
- while (true)
- {
- this.Dispatcher.Invoke(new Action(() =>
- {
- time.Text = DateTime.Now.ToString("HH:mm:ss");
- date.Text = DateTime.Now.ToString("yyyy-MM-dd");
- if (DateTime.Now.DayOfWeek == DayOfWeek.Monday)
- dateRL.Text = "星期一";
- else if (DateTime.Now.DayOfWeek == DayOfWeek.Tuesday)
- dateRL.Text = "星期二";
- else if (DateTime.Now.DayOfWeek == DayOfWeek.Wednesday)
- dateRL.Text = "星期三";
- else if (DateTime.Now.DayOfWeek == DayOfWeek.Thursday)
- dateRL.Text = "星期四";
- else if (DateTime.Now.DayOfWeek == DayOfWeek.Friday)
- dateRL.Text = "星期五";
- else if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday)
- dateRL.Text = "星期六";
- else if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
- dateRL.Text = "星期天";
-
- }));
- Thread.Sleep(500);
- }
- }));
- }
- }
- }
|