123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- using System;
- using System.Linq;
- using System.Text;
- using System.Drawing;
- namespace HNWD.LatticeScreen.Server
- {
- internal class CallingProgram : ProgramBase
- {
- public CallingProgram(LedLatticeScreen ledLatticeScreen, string CallId)
- : base()
- {
- this.ledLatticeScreen = ledLatticeScreen;
- this.CallId = CallId;
- }
- /// <summary>
- /// ascii转字符
- /// </summary>
- /// <returns></returns>
- private static string Chr()
- {
- System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
- byte[] byteArray = new byte[] { (byte)3 };
- string strCharacter = asciiEncoding.GetString(byteArray);
- return (strCharacter);
- }
- /// <summary>
- /// ascii转字符
- /// </summary>
- /// <returns></returns>
- private static string Chr2()
- {
- System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
- byte[] byteArray = new byte[] { (byte)96 };
- string strCharacter = asciiEncoding.GetString(byteArray);
- return (strCharacter);
- }
- /// <summary>
- /// 字符转ascii
- /// </summary>
- /// <param name="character"></param>
- /// <returns></returns>
- public static int Asc(string character)
- {
- System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
- int intAsciiCode = (int)asciiEncoding.GetBytes(character)[0];
- return (intAsciiCode);
- }
- public override void PlayWithErase()
- {
- this.ledLatticeScreen.JHErase();
- if(this.wd_ProgramInfo.PROGRAM_TEXT.Contains(Chr())||this.wd_ProgramInfo.PROGRAM_TEXT.Contains(Chr2()))
- {
- string[] splited = this.wd_ProgramInfo.PROGRAM_TEXT.Split(new string[]{Chr() , Chr2() },StringSplitOptions.RemoveEmptyEntries);
- if(this.ledLatticeScreen.Width > 64)
- {
- /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */
- this.responseByLedCommand = LedControl.JHDrawText(this.ledLatticeScreen.hdl, 0, 0, Convert.ToUInt16(this.ledLatticeScreen.Width), Convert.ToUInt16(this.ledLatticeScreen.Height), 0xE12, splited[0]);
- }
- else if (splited.Length>1)
- {
- /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */
- this.responseByLedCommand = LedControl.JHDrawText(this.ledLatticeScreen.hdl, 0, 0, Convert.ToUInt16(this.ledLatticeScreen.Width), Convert.ToUInt16(this.ledLatticeScreen.Height), 0xE12, splited[1]);
- }
- }
- else
- {
- /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */
- this.responseByLedCommand = LedControl.JHDrawText(this.ledLatticeScreen.hdl, 0, 0, Convert.ToUInt16(this.ledLatticeScreen.Width), Convert.ToUInt16(this.ledLatticeScreen.Height), 0xE12, this.wd_ProgramInfo.PROGRAM_TEXT);
- }
- this.ResponseMessage();
- }
- public override void PlayWithoutErase()
- {
- /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */
- if (this.wd_ProgramInfo.PROGRAM_TEXT.Contains(Chr()) || this.wd_ProgramInfo.PROGRAM_TEXT.Contains(Chr2()))
- {
- string[] splited = this.wd_ProgramInfo.PROGRAM_TEXT.Split(new string[] { Chr() , Chr2() }, StringSplitOptions.RemoveEmptyEntries);
- if (this.ledLatticeScreen.Width > 64)
- {
- /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */
- this.responseByLedCommand = LedControl.JHDrawText(this.ledLatticeScreen.hdl, 0, 0, Convert.ToUInt16(this.ledLatticeScreen.Width), Convert.ToUInt16(this.ledLatticeScreen.Height), 0xE12, splited[0]);
- }
- else if (splited.Length > 1)
- {
- /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */
- this.responseByLedCommand = LedControl.JHDrawText(this.ledLatticeScreen.hdl, 0, 0, Convert.ToUInt16(this.ledLatticeScreen.Width), Convert.ToUInt16(this.ledLatticeScreen.Height), 0xE12, splited[1]);
- }
- }
- else
- {
- /* 调用屏幕操作中的DrawText接口来立即显示一段文本 */
- this.responseByLedCommand = LedControl.JHDrawText(this.ledLatticeScreen.hdl, 0, 0, Convert.ToUInt16(this.ledLatticeScreen.Width), Convert.ToUInt16(this.ledLatticeScreen.Height), 0xE12, this.wd_ProgramInfo.PROGRAM_TEXT);
- }
- this.ResponseMessage();
- }
-
-
- }
- }
|