public void EnqueueObject(char Head, string content)
        {
            object newObj = null;

            if (Head == DDCSrennCmdChars.SI)
            {
                DDC_SI_Command dsi = new DDC_SI_Command();
                if (content.Length > 0)
                {
                    dsi.StartRow = content.Substring(0, 1);
                }
                if (content.Length > 1)
                {
                    dsi.StartColumn = content.Substring(1, 1);
                }
                if (content.Length > 2)
                {
                    dsi.Content = content.Substring(2, content.Length - 2);
                }

                newObj = dsi;
            }
            else if (Head == DDCSrennCmdChars.ESC)
            {
                DDC_ESCP_Command escp        = new DDC_ESCP_Command();
                char             indentifier = content[0];
                switch (indentifier)
                {
                case 'P':
                {
                    char indentifierP = content[1];
                    if (indentifierP == '1' ||
                        indentifierP == '2' ||
                        indentifierP == 'E')
                    {
                        //1显示Logo,2.显示picture,3.先生image(后面是直接文件名如:abc.jpg)
                        if (content.Length > 2)
                        {
                            escp.Content = content.Substring(2, content.Length - 2);
                        }
                        newObj = escp;
                    }
                }
                break;

                default:
                    break;
                }
            }
            else if (Head == DDCSrennCmdChars.SO)
            {
                DDC_SO_Command dso = new DDC_SO_Command();
                dso.Content = content;
                newObj      = dso;
            }
            if (newObj != null)
            {
                toReturn.Add(newObj);
            }
        }
        public void EnqueueObject(char Head, string content)
        {
            object newObj = null;

            if (Head == DDCSrennCmdChars.SI)
            {
                DDC_SI_Command dsi = new DDC_SI_Command();
                if (content.Length > 0)
                {
                    dsi.StartRow = content.Substring(0, 1);
                }
                if (content.Length > 1)
                {
                    dsi.StartColumn = content.Substring(1, 1);
                }
                if (content.Length > 2)
                {
                    dsi.Content = content.Substring(2, content.Length - 2);
                }

                newObj = dsi;
            }
            else if (Head == DDCSrennCmdChars.ESC)
            {
                DDC_ESCP_Command escp        = new DDC_ESCP_Command();
                char             indentifier = content[0];
                switch (indentifier)
                {
                case 'P':
                {
                    if (content.Length > 3)
                    {
                        escp.Content = content.Substring(1, 3);
                    }
                    newObj = escp;
                }
                break;

                default:
                    break;
                }
            }
            else if (Head == DDCSrennCmdChars.SO)
            {
                DDC_SO_Command dso = new DDC_SO_Command();
                dso.Content = content;
                newObj      = dso;
            }
            if (newObj != null)
            {
                toReturn.Add(newObj);
            }
        }
예제 #3
0
        /// <summary>
        /// 执行屏幕
        /// </summary>
        /// <param name="cmdList"></param>
        private void ExcuteScreenCmd(List <object> cmdList)
        {
            foreach (object cmd in cmdList)
            {
                Type currType = cmd.GetType();
                switch (currType.Name)
                {
                case "DDC_SI_Command":
                {
                    if (toPaintSI == null)
                    {
                        toPaintSI = new List <DDC_SI_Command>();
                    }
                    Graphics       g          = pnl_Screen.CreateGraphics();
                    DDC_SI_Command cur_SI     = (DDC_SI_Command)cmd;
                    string         toPaintStr = cur_SI.Content;
                    startRow    = cur_SI.StartRow;
                    startColumn = cur_SI.StartColumn;
                    if (!string.IsNullOrEmpty(toPaintStr))
                    {
                        DrawString(g, toPaintStr, startRow, startColumn, XDCUnity.ScreenParseStringColor);
                    }
                }
                break;

                case "DDC_ESCP_Command":
                {
                    DDC_ESCP_Command cur_ESCP = (DDC_ESCP_Command)cmd;

                    SetBackgroundImage_ESCP(cur_ESCP.Content);
                }
                break;

                case "DDC_SO_Command":
                {
                    DDC_SO_Command cur_SO = (DDC_SO_Command)cmd;
                    Insert_SO(cur_SO.Content);
                }
                break;

                default:
                    break;
                }
            }
            //DrawSI_Text();
        }