예제 #1
0
    private void ProceedKernelMessage(IntPtr wParam, IntPtr lParam)
    {
        CoreMsgEnum kParam = (CoreMsgEnum)wParam.ToInt32();

        switch (kParam)
        {
        case CoreMsgEnum.Power_On:
        {
            this.DialogResult = CYReturnButton = DialogResult.Cancel;
            this.Close();
            break;
        }

        case CoreMsgEnum.Status_Change:
        {
            JetStatusEnum status = (JetStatusEnum)lParam.ToInt32();
            if (status == JetStatusEnum.PowerOff || status == JetStatusEnum.Error)
            {
                this.DialogResult = CYReturnButton = DialogResult.Cancel;
                this.Close();
            }
            break;
        }
        }
    }
예제 #2
0
파일: Form1.cs 프로젝트: 6555355/Scan_yan1
        private void ProceedKernelMessage(IntPtr wParam, IntPtr lParam)
        {
            CoreMsgEnum kParam = (CoreMsgEnum)wParam.ToInt64();

            switch (kParam)
            {
            case CoreMsgEnum.UpdaterPercentage:
            {
                int percentage = (int)lParam.ToInt64();
                //OnPrintingProgressChanged(percentage);
                string info            = "";
                string mPrintingFormat = ResString.GetUpdatingProgress();
                info += "\n" + string.Format(mPrintingFormat, percentage);
                this.m_StatusBarPanelPercent.Text = info;
                break;
            }

            case CoreMsgEnum.Percentage:
            {
                int percentage = (int)lParam.ToInt64();
                OnPrintingProgressChanged(percentage);

                break;
            }

            case CoreMsgEnum.Job_Begin:
            {
                int startType = (int)lParam.ToInt64();

                if (startType == 0)
                {
                }
                else if (startType == 1)
                {
                    //OnPrintingStart();
                }

                break;
            }

            case CoreMsgEnum.Job_End:
            {
                int endType = (int)lParam.ToInt64();

                if (endType == 0)
                {
                }
                else if (endType == 1)
                {
                    //OnPrintingEnd();
                }

                break;
            }

            case CoreMsgEnum.Power_On:
            {
                int bPowerOn = (int)lParam.ToInt64();
                if (bPowerOn != 0)
                {
                    int bPropertyChanged, bSettingChanged;
                    SPrinterProperty sPrinterProperty;
                    SPrinterSetting  sPrinterSetting;

                    m_allParam.PowerOnEvent(out bPropertyChanged, out bSettingChanged, out sPrinterProperty, out sPrinterSetting);
                    if (bPropertyChanged != 0)
                    {
                        OnPrinterPropertyChange(sPrinterProperty);
                    }
                    if (bSettingChanged != 0)
                    {
                        OnPrinterSettingChange(sPrinterSetting);
                    }
                }
                else
                {
                    m_allParam.PowerOffEvent();
                }
                break;
            }

            case CoreMsgEnum.Status_Change:
            {
                int status = (int)lParam.ToInt64();
                OnPrinterStatusChanged((JetStatusEnum)status);
                break;
            }

            case CoreMsgEnum.ErrorCode:
            {
                OnErrorCodeChanged((int)lParam.ToInt64());
                //For Updateing
                int        errorcode  = (int)lParam.ToInt64();
                SErrorCode serrorcode = new SErrorCode(errorcode);
                ErrorCause cause      = (ErrorCause)serrorcode.nErrorCause;
                if (cause == ErrorCause.CoreBoard && (ErrorAction)serrorcode.nErrorAction == ErrorAction.Updating)
                {
                    if (0 != serrorcode.n16ErrorCode)
                    {
                        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);
                        }
#if !LIYUUSB
                        CoreInterface.SendJetCommand((int)JetCmdEnum.ClearUpdatingStatus, 0);
#endif
                    }
                }

                break;
            }

            case CoreMsgEnum.Parameter_Change:
            {
                //m_LockUpdate = true;
                SPrinterSetting sPrinterSetting = m_allParam.PrinterSetting;
                if (CoreInterface.GetPrinterSetting(ref sPrinterSetting) == 0)
                {
                    Debug.Assert(false);
                }
                else
                {
                    OnPrinterSettingChange(sPrinterSetting);
                }
                //m_LockUpdate = false;
                break;
            }

            case CoreMsgEnum.Ep6Pipe:
            {
                int    ep6Cmd = (int)lParam.ToInt64() & 0x0000ffff;
                int    index  = (((int)lParam.ToInt64()) >> 16);
                byte[] bufep6 = null;
                int    buflen = 0;
                int    ret    = (CoreInterface.GetEp6PipeData(ep6Cmd, index, bufep6, ref buflen));
                if (ret != 0 && buflen > 0)
                {
                    bufep6 = new byte[buflen];
                    if (CoreInterface.GetEp6PipeData(ep6Cmd, index, bufep6, ref buflen) != 0)
                    {
                        switch (bufep6[0])
                        {
                        case 0xD4:
                            if (QRCodeForm != null)
                            {
                                QRCodeForm.SetQrCode(bufep6);
                            }
                            break;

                        case 0xD3:
                            if (QRCodeForm != null)
                            {
                                QRCodeForm.FeedBack(bufep6);
                            }
                            break;

                        case 0xE6:
                            if (QRCodeForm != null)
                            {
                                QRCodeForm.SetQrCodeFromHead(bufep6);
                            }
                            break;
                        }
                    }
                    else
                    {
                        MessageBox.Show(ResString.GetResString("GetEp6PipeDatafail"));
                    }
                }
                //else
                //{
                //    MessageBox.Show("GetEp6PipeData  buflen fail!");
                //}
            }
            break;
            }
        }
예제 #3
0
        public void ProceedKernelMessage(IntPtr wParam, IntPtr lParam)
        {
            CoreMsgEnum kParam = (CoreMsgEnum)wParam.ToInt32();

            switch (kParam)
            {
            case CoreMsgEnum.HardPanelDirty:
            {
                Ep6Cmd cmd = (Ep6Cmd)lParam.ToInt32();
                switch (cmd)
                {
                case Ep6Cmd.EP6_CMD_T_WAVE_READ_READY:
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_READ_READY");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_READ_READY 波形预读完成");

                    int TotalLength = EpsonLCD.GetWaveDataTotalLength();
                    m_WaveData.NewParse2(HBTypeName, EpsonLCD.GetWaveData(TotalLength), m_CycleValue);

                    //保存刚刚获得的波形数据,在幅值方式为电压改变时有用
                    m_OriginalWaveSnips = new List <WaveDataSnip>(m_WaveData.WaveDatas);

                    ////导入Wave和NM数据
                    //ImportWaveNMData();

                    //btnIFSSave.Enabled = true;
                    //m_Button_Import.Enabled = true;
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_SET_READY:
                {
                    //波形发送完成,发送幅值
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_SET_READY");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_SET_READY 波形发送完成,发送幅值");

                    if (m_Waves.Count == 0)
                    {
                        break;
                    }

                    WaveDataEx WaveData = m_Waves[0];

                    m_AmplitudeToSends.Clear();
                    foreach (IAmplitude Amplitude in WaveData.Amplitudes)
                    {
                        m_AmplitudeToSends.Add(Amplitude);
                    }

                    if (0 == m_AmplitudeToSends.Count)
                    {
                        throw new Exception("0 == m_AmplitudeToSends.Count");
                    }

                    int Length = EpsonLCD.WriteAmplitudeData(m_AmplitudeToSends[0].GetBytes());
                    EpsonLCD.SetAmplitudeTotalLength(Length);
                }
                break;

                case Ep6Cmd.EP6_CMD_T_SWING_READY:
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_SWING_READY");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_SWING_READY 幅值下发完成");
                    if (m_AmplitudeToSends.Count > 0)
                    {
                        m_AmplitudeToSends.RemoveAt(0);
                    }
                    if (m_AmplitudeToSends.Count > 0)
                    {
                        int Length = EpsonLCD.WriteAmplitudeData(m_AmplitudeToSends[0].GetBytes());
                        EpsonLCD.SetAmplitudeTotalLength(Length);
                    }
                    else
                    {
                        //幅值发送完成,发送新增加节点信息,暂时为空
                        byte[] NewNode = new byte[2];

                        NewNode[0] = 0xFF;

                        int Length = EpsonLCD.WriteNewAddNodeData(NewNode);

                        EpsonLCD.SetNewAddNodeTotalLength(1);
                    }
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_POINT_FINISH:
                {
                    //新添加节点数据发送完成命令
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_POINT_FINISH");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_POINT_FINISH 新添加节点数据发送完成命令");

                    int Length = EpsonLCD.WriteWaveMappingData(ConstructWaveMapping());
                    EpsonLCD.SetWaveMappingTotalLength(Length);
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_NAME_READY:
                    //预读波形名字就绪,开始读波形名字
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_NAME_READY");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_NAME_READY 预读波形命令下发完成");

                    //取得波形名字总长度
                    int TotalSize = EpsonLCD.GetWaveNameTotalLength();

                    //取得波形名字数据
                    ParseWaveName(EpsonLCD.GetWaveNameData(TotalSize), TotalSize);

                    //预读映射表命令
                    EpsonLCD.PrepareReadWaveMapping();
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_NAME_FINISH:
                    //波形名字发送完成命令
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_NAME_FINISH");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_NAME_FINISH 波形名字修改发送完成命令");
                    MessageBox.Show(ResString.GetResString("Wave_Info_WaveNameUpdataFinish"), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    ControlsEnable(true);
                }
                break;

                case Ep6Cmd.EP6_CMD_T_WAVE_CHANNEL_FINISH:
                    //波形映射表完成命令
                {
                    FileLog("Ep6Cmd.EP6_CMD_T_WAVE_CHANNEL_FINISH");
                    Debug.WriteLine("Ep6Cmd.EP6_CMD_T_WAVE_CHANNEL_FINISH 波形映射表完成命令");
                    //获得波形映射总长度
                    int TotalSize = EpsonLCD.GetWaveMappingTotalLength();
                    if (0 == TotalSize)
                    {
                        MessageBox.Show(ResString.GetResString("Wave_Info_ReadWaveMapping0Length"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    //取得波形映射数据
                    ParseWaveMapping(EpsonLCD.GetWaveMappingData(TotalSize), TotalSize);

                    if (m_ImportMappingFlag == false)
                    {
                        //用户自定义
                        CustomInitialize();
                        //界面上所有控件显示
                        this.Visible = true;
                        //波形映射导入完成
                        m_ImportMappingFlag = true;
                    }
                    else
                    {
                        MessageBox.Show(ResString.GetResString("Wave_Info_WaveMappingReadFinish"), "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        ControlsEnable(true);
                        m_ComboBox_Channel_SelectedIndexChanged(null, null);
                        m_ComboBox_VSD_SelectedIndexChanged(null, null);
                    }
                }
                break;
                }
            }
            break;

            case CoreMsgEnum.Status_Change:
            {
                int status = lParam.ToInt32();
                if ((JetStatusEnum)status == JetStatusEnum.Ready && IsAutoWave && IsAutoPrint && !IsAutoStop)
                {
                    IsAutoPrint = false;
                    AutoUpdateVave();
                }
                else if ((JetStatusEnum)status == JetStatusEnum.Busy && IsAutoWave && !IsAutoPrint && !IsAutoStop)
                {
                    IsAutoPrint = true;
                }
                break;
            }
            }
        }
예제 #4
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);
        }