终端一体化运控平台
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

DateTimeUI.xaml.cs 2.0 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16. namespace BPASmartClient.SCADAControl.CustomerControls
  17. {
  18. /// <summary>
  19. /// DateTimeUI.xaml 的交互逻辑
  20. /// </summary>
  21. public partial class DateTimeUI : UserControl
  22. {
  23. public DateTimeUI()
  24. {
  25. InitializeComponent();
  26. Task.Run(new Action(() =>
  27. {
  28. while (true)
  29. {
  30. this.Dispatcher.Invoke(new Action(() =>
  31. {
  32. time.Text = DateTime.Now.ToString("HH:mm:ss");
  33. date.Text = DateTime.Now.ToString("yyyy-MM-dd");
  34. if (DateTime.Now.DayOfWeek == DayOfWeek.Monday)
  35. dateRL.Text = "星期一";
  36. else if (DateTime.Now.DayOfWeek == DayOfWeek.Tuesday)
  37. dateRL.Text = "星期二";
  38. else if (DateTime.Now.DayOfWeek == DayOfWeek.Wednesday)
  39. dateRL.Text = "星期三";
  40. else if (DateTime.Now.DayOfWeek == DayOfWeek.Thursday)
  41. dateRL.Text = "星期四";
  42. else if (DateTime.Now.DayOfWeek == DayOfWeek.Friday)
  43. dateRL.Text = "星期五";
  44. else if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday)
  45. dateRL.Text = "星期六";
  46. else if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday)
  47. dateRL.Text = "星期天";
  48. }));
  49. Thread.Sleep(500);
  50. }
  51. }));
  52. }
  53. }
  54. }