123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using HNWD.Pregrant.Common;
- using HNWD.Pregrant.DataAccess;
- using HNWD.Pregrant.Model;
- namespace HNWD.LatticeScreen.Server
- {
- internal abstract class ProgramBase
- {
- protected WD_ProgramInfoDataAccess wd_ProgramInfoDataAccess = WD_ProgramInfoDataAccess.GetInstance();
- protected LedLatticeScreen ledLatticeScreen;
- protected WD_ProgramInfo wd_ProgramInfo;
- protected uint AlignMode = 0;
- protected uint FormatMode = 0;
- public string CallId = string.Empty;
- public long addTime = DateTime.Now.Ticks;
- protected int responseByLedCommand = 0;
- public bool bSuccess = true;
- public string Msg = "操作成功";
- public ProgramBase()
- {
- }
- protected bool ProgramIsNull
- {
- get { return this.wd_ProgramInfo == null ? true : false; }
- }
- public virtual void SetEntity(WD_ProgramInfo wd_ProgramInfo)
- {
- this.wd_ProgramInfo = wd_ProgramInfo;
- }
- public virtual WD_ProgramInfo GetEntity()
- {
- return this.wd_ProgramInfo;
- }
- /// <summary>
- /// 带刷屏显示
- /// </summary>
- /// <param name="state"></param>
- public abstract void PlayWithErase();
- /// <summary>
- /// 不带刷屏显示
- /// </summary>
- /// <param name="state"></param>
- public abstract void PlayWithoutErase();
- protected void GetTextAlignMode(string index)
- {
- List<string> listAlign = new List<string>();
- listAlign.Add("水平左垂直上对齐");
- listAlign.Add("水平左垂直中对齐");
- listAlign.Add("水平左垂直下对齐");
- listAlign.Add("水平中垂直上对齐");
- listAlign.Add("水平中垂直中对齐");
- listAlign.Add("水平中垂直下对齐");
- listAlign.Add("水平右垂直上对齐");
- listAlign.Add("水平右垂直中对齐");
- listAlign.Add("水平右垂直下对齐");
- string cn = listAlign[Convert.ToInt32(index)];
- TextProgramAlign tpa = TextProgramAlignList.GetList().Find(f => f.AlignName_CN == cn);
- this.AlignMode = TextProgramAlignList.GetValue(tpa.AlignName_EN);
- }
- protected void GetBitmapAlignMode(string index)
- {
- List<string> listAlign = new List<string>();
- listAlign.Add("水平左垂直上对齐");
- listAlign.Add("水平左垂直中对齐");
- listAlign.Add("水平左垂直下对齐");
- listAlign.Add("水平中垂直上对齐");
- listAlign.Add("水平中垂直中对齐");
- listAlign.Add("水平中垂直下对齐");
- listAlign.Add("水平右垂直上对齐");
- listAlign.Add("水平右垂直中对齐");
- listAlign.Add("水平右垂直下对齐");
- string cn = listAlign[Convert.ToInt32(index)];
- TextProgramAlign tpa = TextProgramAlignList.GetList().Find(f => f.AlignName_CN == cn);
- this.AlignMode = BitmapProgramAlignList.GetValue(tpa.AlignName_EN);
- }
- protected void GetClockFormatMode(string index)
- {
- List<string> listAlign = new List<string>();
- listAlign.Add("yyyy年MM月dd日HH时mm分ss秒");
- listAlign.Add("yyyy年MM月dd日");
- listAlign.Add("HH时mm分ss秒");
- string cn = listAlign[Convert.ToInt32(index)];
- TextProgramAlign tpa = ClockProgramFormatList.GetList().Find(f => f.AlignName_CN == cn);
- this.FormatMode = ClockProgramFormatList.GetValue(tpa.AlignName_EN);
- }
- protected virtual void ResponseMessage()
- {
- if (responseByLedCommand == LedControl.JR_OK)
- {
- this.Msg = "发送DrawText指令成功";
- this.bSuccess = true;
- }
- else
- {
- this.Msg = "发送DrawText指令失败, 错误代码:" + responseByLedCommand;
- this.bSuccess = false;
- }
- }
- protected virtual void ResponseMessage(bool bbitmap)
- {
- if (responseByLedCommand == LedControl.JR_OK)
- {
- this.Msg = "发送JHDrawMultPixel指令成功";
- this.bSuccess = true;
- }
- else
- {
- this.Msg = "发送JHDrawMultPixel指令失败, 错误代码:" + responseByLedCommand;
- this.bSuccess = false;
- }
- }
- }
- }
|