using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace HNWD.LatticeScreen.Server { internal class ClockCustomizedProgram : ProgramBase { private string displayText = string.Empty; public ClockCustomizedProgram(LedLatticeScreen ledLatticeScreen) : base() { this.ledLatticeScreen = ledLatticeScreen; } public override void PlayWithErase() { this.GetTextAlignMode(this.wd_ProgramInfo.PROGRAM_ALIGN); this.ledLatticeScreen.JHErase(); /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */ this.ValidateDateTime(); 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); this.ResponseMessage(); } public override void PlayWithoutErase() { this.GetTextAlignMode(this.wd_ProgramInfo.PROGRAM_ALIGN); /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */ this.ValidateDateTime(); 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); this.ResponseMessage(); } private void ValidateDateTime() { try { this.displayText = DateTime.Now.ToString(this.wd_ProgramInfo.PROGRAM_FORMAT.Trim()); } catch { this.displayText = string.Empty; } } } }