コード例 #1
0
ファイル: UCMessage.cs プロジェクト: windygu/.net-wms
        public int AddWithoutEnter(string text)
        {
            CheckClearContent();

            listMessage.AppendText(MutiLanguages.ParserMessage(text));
            //Amoi,Laws Lu,2005/08/05,修改	允许滚动条自动滚动到添加字符的位置
            listMessage.Focus();
            listMessage.ScrollToCaret();

            //EndAmoi

            return(_return);
        }
コード例 #2
0
ファイル: UCMessage.cs プロジェクト: windygu/.net-wms
        public void AddEx(string function, string inputContent, Message message, bool recordWorkingError)
        {
            Font norfont  = new Font("宋体", 12F);
            Font boldFont = new Font("宋体", 16F, FontStyle.Bold);

            switch (message.Type)
            {
            case MessageType.Normal:
                listMessage.AppendText("");
                this.listMessage.SelectionColor = Color.Black;
                this.listMessage.SelectionFont  = norfont;

                this.AddText(message.Body);
                break;

            case MessageType.Success:

                #region 处理成功的信息显示
                listMessage.AppendText("");
                this.listMessage.SelectionColor = Color.Blue;
                this.listMessage.SelectionFont  = norfont;

                String sucMessages = String.Empty;
                String sucCard     = String.Empty;

                if (message.Body == string.Empty)
                {
                    sucMessages = message.Exception.Message;
                }
                else
                {
                    sucMessages = message.Body;
                }

                //int iSucPosition = sucMessages.IndexOf("$CS_Param_ID");
                //if (iSucPosition > 0)
                //{
                //    if (sucMessages.IndexOf(":") >= 0 || sucMessages.IndexOf("=") >= 0)
                //    {
                //        iSucPosition = iSucPosition + 1;
                //    }
                //    sucCard = sucMessages.Substring(iSucPosition + 12, sucMessages.Length - iSucPosition - 12);
                //    sucMessages = sucMessages.Remove(iSucPosition + 12, sucMessages.Length - iSucPosition - 12);
                //    //添加非产品序列号的信息
                //    this.AddWithoutEnter(sucMessages);

                //    this.listMessage.SelectionColor = Color.Black;
                //    this.listMessage.SelectionFont = boldFont;
                //    //获取下一个分隔的位置
                //    int iNextEmptyPosition = sucCard.Trim().IndexOf(" ");
                //    if (iNextEmptyPosition < 0)
                //    {
                //        this.AddText(sucCard);
                //    }
                //    else
                //    {
                //        sucCard = sucCard.Substring(0, iNextEmptyPosition);
                //        sucMessages = sucCard.Remove(0, iNextEmptyPosition);

                //        this.AddText(sucCard);

                //        this.listMessage.SelectionColor = Color.Blue;
                //        this.listMessage.SelectionFont = norfont;

                //        if (sucMessages != String.Empty)
                //        {
                //            this.AddText(sucMessages);
                //        }
                //    }

                //}
                //else
                //{
                this.AddText(sucMessages);
                //}

                //added by leon.li @20130311 声音提示
                SoundPlayer.PlaySuccessMusic();

                break;
                #endregion

            case MessageType.DisplayError:
            case MessageType.Error:

                #region 处理错误的信息显示
                listMessage.AppendText("");
                this.listMessage.SelectionColor = Color.Red;
                this.listMessage.SelectionFont  = norfont;

                String errMessages = String.Empty;
                String rCard       = String.Empty;

                string errText = string.Empty;     //用于记录错误信息到数据库时使用

                if (message.Body == string.Empty)
                {
                    errMessages = message.Exception.Message;
                }
                else
                {
                    errMessages = message.Body;
                }

                //int iPosition = errMessages.IndexOf("$CS_Param_ID");
                //if (iPosition > 0)
                //{
                //    if (errMessages.IndexOf(":") >= 0 || errMessages.IndexOf("=") >= 0)
                //    {
                //        iPosition = iPosition + 1;
                //    }
                //    rCard = errMessages.Substring(iPosition + 12, errMessages.Length - iPosition - 12);
                //    errMessages = errMessages.Remove(iPosition + 12, errMessages.Length - iPosition - 12);
                //    //添加非产品序列号的信息
                //    this.AddWithoutEnter(errMessages);
                //    errText += errMessages;

                //    this.listMessage.SelectionColor = Color.Black;
                //    this.listMessage.SelectionFont = boldFont;
                //    //获取下一个分隔的位置
                //    int iNextEmptyPosition = rCard.Trim().IndexOf(" ");
                //    if (iNextEmptyPosition < 0)
                //    {
                //        this.AddText(rCard);
                //        errText += rCard;
                //    }
                //    else
                //    {
                //        rCard = rCard.Substring(0, iNextEmptyPosition);
                //        errMessages = rCard.Remove(0, iNextEmptyPosition);

                //        this.AddText(rCard);
                //        errText += rCard;

                //        this.listMessage.SelectionColor = Color.Red;
                //        this.listMessage.SelectionFont = norfont;

                //        if (errMessages != String.Empty)
                //        {
                //            this.AddText(errMessages);
                //            errText += errMessages;
                //        }
                //    }

                //}
                //else
                //{
                this.AddText(errMessages);
                errText += errMessages;
                //}

                try
                {
                    if (recordWorkingError && WorkingErrorAdded != null)
                    {
                        WorkingErrorAdded(this.Parent, new WorkingErrorAddedEventArgs(function, inputContent, message, MutiLanguages.ParserMessage(errText)));
                    }
                }
                catch (Exception ex)
                {
                    //throw ex;
                }
                //added by leon.li @20130311 声音提示
                SoundPlayer.PlayErrorMusic();
                break;

                #endregion
            }
        }
コード例 #3
0
ファイル: UCErrorCodeSelect.cs プロジェクト: windygu/.net-wms
 private void UCErrorCodeSelect_Load(object sender, System.EventArgs e)
 {
     lblMessage.Text = MutiLanguages.ParserMessage("$CS_SLIP_OK") + "\r\n"
                       + MutiLanguages.ParserMessage("$CS_SLIP_FAIL");
 }