Beispiel #1
0
        public void OnPrinterStatusChanged(JetStatusEnum status)
        {
            UpdateButtonStates(status);
            SetPrinterStatusChanged(status);
            if (status == JetStatusEnum.Error)
            {
                OnErrorCodeChanged(CoreInterface.GetBoardError());

                int        errorCode  = CoreInterface.GetBoardError();
                SErrorCode sErrorCode = new SErrorCode(errorCode);
                if (SErrorCode.IsOnlyPauseError(errorCode))
                {
                    string errorInfo = SErrorCode.GetInfoFromErrCode(errorCode);

                    if (
                        MessageBox.Show(errorInfo, ResString.GetProductName(), MessageBoxButtons.RetryCancel,
                                        MessageBoxIcon.Exclamation) == DialogResult.Retry)
                    {
                        CoreInterface.Printer_Resume();
                    }
                }
            }
            else
            {
                OnErrorCodeChanged(0);
            }
            if (status != JetStatusEnum.PowerOff && status != JetStatusEnum.Initializing && m_IsFATAL == false)
            {
                if (SPrinterProperty.IsGongZeng() || SPrinterProperty.IsDocanPrintMode() || SPrinterProperty.IsRuiZhi()) // 此功能按 厂商限定
                {
                    byte[]           infos = new byte[19];
                    BYHX_SL_RetValue ret   = BYHXSoftLock.GetDongleInfo(ref infos);
                    if (ret == BYHX_SL_RetValue.SUCSESS)
                    {
                        byte[] dtV = new byte[4];
                        Buffer.BlockCopy(infos, 4, dtV, 0, dtV.Length);
                        uint boardId = BitConverter.ToUInt32(dtV, 0);
                        if (CoreInterface.IsFatal(boardId))
                        {
                            m_IsFATAL = true;
                        }
                    }
                }
                else
                {
                    m_IsFATAL = true;
                }
            }
        }
Beispiel #2
0
 public void OnErrorCodeChanged(int code)
 {
     this.m_StatusBarPanelError.Text = SErrorCode.GetInfoFromErrCode(code);
 }
Beispiel #3
0
        protected override void WndProc(ref System.Windows.Forms.Message msg)
        {
            const string LineEnd = "\r\n";

            // Dispose user message.
            if (msg.Msg == m_MessageUpdater)
            {
                int         nMsg    = (int)msg.WParam;
                CoreMsgEnum coremsg = (CoreMsgEnum)nMsg;
                switch (coremsg)
                {
                case CoreMsgEnum.Status_Change:
                {
                    int status = msg.LParam.ToInt32();

//						int portid = (int)msg.LParam;
//						BoardEnum board = (BoardEnum)portid;
//						m_TextBoxStatus.Text +=  ResString.GetEnumDisplayName(typeof(UpdateDisplay),UpdateDisplay.Status)+
//							ResString.GetEnumDisplayName(typeof(UpdateDisplay),UpdateDisplay.Begin) +
//							board.ToString();

                    m_TextBoxStatus.Text += status.ToString();
                    m_TextBoxStatus.Text += LineEnd;
                }
                break;

                case CoreMsgEnum.Percentage:
                {
                    int percent = (int)msg.LParam;
                    if (percent > 100)
                    {
                        percent = 100;
                    }
                    if (percent < 0)
                    {
                        percent = 0;
                    }
                    m_ProgressBarPercent.Value = (int)percent;
#if false
                    m_TextBoxStatus.Text += ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Status) + percent.ToString() +
                                            ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Percentage);
                    m_TextBoxStatus.Text += LineEnd;
#endif
                }
                break;

                case CoreMsgEnum.ErrorCode:
                {
                    int errorcode = (int)msg.LParam;
//						m_TextBoxStatus.Text += ResString.GetEnumDisplayName(typeof(UpdateDisplay),UpdateDisplay.Status) +
//							ResString.GetEnumDisplayName(typeof(UpdateDisplay),UpdateDisplay.Failed);
                    m_TextBoxStatus.Text += SErrorCode.GetInfoFromErrCode(errorcode);
                    m_TextBoxStatus.Text += "[" + errorcode.ToString("X") + "]";
                    m_TextBoxStatus.Text += LineEnd;

                    SErrorCode serrorcode = new SErrorCode(errorcode);
                    ErrorCause cause      = (ErrorCause)serrorcode.nErrorCause;
                    if (cause == ErrorCause.CoreBoard && (ErrorAction)serrorcode.nErrorAction == ErrorAction.Updating)
                    {
                        if (0 != serrorcode.n16ErrorCode)
                        {
                            CoreInterface.SendJetCommand((int)JetCmdEnum.ClearUpdatingStatus, 0);
                        }
                        if (serrorcode.n16ErrorCode == 1)
                        {
                            string info = ResString.GetEnumDisplayName(typeof(UISuccess), UISuccess.UpdateSuccess);
                            MessageBox.Show(info, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            string info = ResString.GetEnumDisplayName(typeof(UIError), UIError.UpdateFail);
                            MessageBox.Show(info, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                break;

                case CoreMsgEnum.Job_Begin:
                    m_TextBoxStatus.Text += ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Status) +
                                            ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Begin);
                    m_TextBoxStatus.Text += LineEnd;
                    break;

                case CoreMsgEnum.Job_End:
                    m_TextBoxStatus.Text += ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Status) +
                                            ResString.GetEnumDisplayName(typeof(UpdateDisplay), UpdateDisplay.Success);
                    m_TextBoxStatus.Text += LineEnd;
                    break;
                }
                return;
            }

            base.WndProc(ref msg);
        }