ClockCustomizedProgram.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. namespace HNWD.LatticeScreen.Server
  8. {
  9. internal class ClockCustomizedProgram : ProgramBase
  10. {
  11. private string displayText = string.Empty;
  12. public ClockCustomizedProgram(LedLatticeScreen ledLatticeScreen)
  13. : base()
  14. {
  15. this.ledLatticeScreen = ledLatticeScreen;
  16. }
  17. public override void PlayWithErase()
  18. {
  19. this.GetTextAlignMode(this.wd_ProgramInfo.PROGRAM_ALIGN);
  20. this.ledLatticeScreen.JHErase();
  21. /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */
  22. this.ValidateDateTime();
  23. this.responseByLedCommand = LedControl.JHDrawText(this.ledLatticeScreen.hdl, Convert.ToInt16(this.wd_ProgramInfo.PROGRAM_X), Convert.ToInt16(this.wd_ProgramInfo.PROGRAM_Y), Convert.ToUInt16(this.wd_ProgramInfo.PROGRAM_WIDTH), Convert.ToUInt16(this.wd_ProgramInfo.PROGRAM_HEIGHT), this.AlignMode, this.displayText);
  24. this.ResponseMessage();
  25. }
  26. public override void PlayWithoutErase()
  27. {
  28. this.GetTextAlignMode(this.wd_ProgramInfo.PROGRAM_ALIGN);
  29. /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */
  30. this.ValidateDateTime();
  31. this.responseByLedCommand = LedControl.JHDrawText(this.ledLatticeScreen.hdl, Convert.ToInt16(this.wd_ProgramInfo.PROGRAM_X), Convert.ToInt16(this.wd_ProgramInfo.PROGRAM_Y), Convert.ToUInt16(this.wd_ProgramInfo.PROGRAM_WIDTH), Convert.ToUInt16(this.wd_ProgramInfo.PROGRAM_HEIGHT), this.AlignMode, this.displayText);
  32. this.ResponseMessage();
  33. }
  34. private void ValidateDateTime()
  35. {
  36. try
  37. {
  38. this.displayText = DateTime.Now.ToString(this.wd_ProgramInfo.PROGRAM_FORMAT.Trim());
  39. }
  40. catch
  41. {
  42. this.displayText = string.Empty;
  43. }
  44. }
  45. }
  46. }