예제 #1
0
        private void SetPassword(string strMainPwd, int bLang)
        {
            int iRet = 0;

            //

            //validCheck should add here
            if (strMainPwd != null && strMainPwd.Length != CoreConst.MAX_PASSWORD_LEN)
            {
                string sFilterString = strMainPwd.Replace("-", null);
                iRet = CoreInterface.SetPassword(sFilterString.ToUpper(), sFilterString.Length, (ushort)BoardEnum.CoreBoard, bLang);
            }
            if (iRet == 0)
            {
                MessageBox.Show(ResString.GetEnumDisplayName(typeof(UIError), UIError.SetPasswordFail),
                                ResString.GetProductName(),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Asterisk);
            }
            else
            {
                MessageBox.Show(ResString.GetEnumDisplayName(typeof(UISuccess), UISuccess.SetPassword),
                                ResString.GetProductName(),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
        }
예제 #2
0
        private void btnClear_Click(object sender, EventArgs e)
        {
            string info = ResString.GetResString("ColseNozzle_ClearAll_Question");

            if (MessageBox.Show(info, ResString.GetProductName(), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                listBox1.Items.Clear();
            }
        }
예제 #3
0
        public bool Start(IntPtr handle, bool bWrBd)
        {
            DEV_BROADCAST_DEVICEINTERFACE dbf = new DEV_BROADCAST_DEVICEINTERFACE();

            dbf.dbcc_size       = Marshal.SizeOf(dbf);
            dbf.dbcc_devicetype = Common.DBT_DEVTYP_DEVICEINTERFACE;
            dbf.dbcc_reserved   = 0;
            IntPtr hDevNotify1 = Common.RegisterDeviceNotification(handle, dbf, Common.DEVICE_NOTIFY_WINDOW_HANDLE | Common.DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
            int    lt          = 0;

            if (bWrBd)
            {
                BYHXSoftLock.CheckDongle_WrBd();
            }
            else
            {
                BYHXSoftLock.CheckDongle();
            }
#if ADD_HARDKEY
            BYHX_SL_RetValue ret = BYHXSoftLock.CheckValidDate(ref lt);

            switch (ret)
            {
            case BYHX_SL_RetValue.EXPIRED:
                m_bOutdated = true;
                MessageBox.Show(ResString.GetResString("EncryptDog_Expired"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                break;

            case BYHX_SL_RetValue.ILLEGALDOG:
                MessageBox.Show(ResString.GetResString("EncryptDog_Illegal"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);

            case BYHX_SL_RetValue.NOFOUNDDOG:
                MessageBox.Show(ResString.GetResString("EncryptDog_NoFound"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);

            case BYHX_SL_RetValue.WILLEXPIREDWORNING_100:
                MessageBox.Show(ResString.GetResString("EncryptDog_Warning"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                tCheckDog.Interval = (lt - 1) * 60 * 1000 + 1;
                tCheckDog.Tick    += new EventHandler(tCheckDog_Tick);
                tCheckDog.Start();
                break;

            default:
                break;
            }
            if (lt > 60 * 100 && lt - 100 * 60 <= int.MaxValue / 1000 / 60)
            {
                tCloseTimer.Interval = (lt - 100 * 60) * 60 * 1000;
                tCloseTimer.Tick    += new EventHandler(tCloseTimer_Tick);
                tCloseTimer.Start();
            }
#endif
            return(true);
        }
예제 #4
0
파일: Form1.cs 프로젝트: 6555355/Scan_yan1
        public PrinterWrite()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            this.Text = ResString.GetProductName();
        }
예제 #5
0
 private void m_ButtonSetLang_Click(object sender, EventArgs e)
 {
     try
     {
         string strMainPwd = m_SerialNoControlLang.GetText();
         SetPassword(strMainPwd, 1);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #6
0
파일: Form1.cs 프로젝트: 6555355/Scan_yan1
        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;
                }
            }
        }
예제 #7
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     //if (this.checkBoxClose.Checked == false)
     //{
     //    if (File.Exists(filePath))
     //    {
     //        File.Delete(filePath);
     //    }
     //}
     //else
     {
         Save();
         MessageBox.Show("Save Successful!", ResString.GetProductName());
     }
 }
 private void buttonAdd_Click(object sender, System.EventArgs e)
 {
     if (FileName1 != null && FileName1 != string.Empty &&
         FileName2 != null && FileName2 != string.Empty &&
         FileName1 != FileName2)
     {
         SPrtFileInfo jobInfo  = new SPrtFileInfo();
         SPrtFileInfo jobInfo1 = new SPrtFileInfo();
         Int32        bret     = 0;
         bret = CoreInterface.Printer_GetFileInfo(FileName1, ref jobInfo, 0);
         if (bret == 1)
         {
             bret = CoreInterface.Printer_GetFileInfo(FileName2, ref jobInfo1, 0);
             if (bret == 1)
             {
                 if (
                     jobInfo.sImageInfo.nImageResolutionX != jobInfo1.sImageInfo.nImageResolutionX ||
                     jobInfo.sImageInfo.nImageResolutionY != jobInfo1.sImageInfo.nImageResolutionY ||
                     jobInfo.sImageInfo.nImageWidth != jobInfo1.sImageInfo.nImageWidth ||
                     jobInfo.sImageInfo.nImageHeight != jobInfo1.sImageInfo.nImageHeight
                     //|| jobInfo.sImageInfo.nImageColorNum !=jobInfo1.sImageInfo.nImageColorNum
                     || jobInfo.sImageInfo.nImageColorDeep != jobInfo1.sImageInfo.nImageColorDeep
                     )
                 {
                     string info = "俩个文件属性不匹配.[分辨率,尺寸,色深]";                            //SErrorCode.GetEnumDisplayName(typeof(Software),Software.Parser);
                     MessageBox.Show(info, ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     this.DialogResult = DialogResult.OK;
                 }
             }
         }
         if (bret != 1)
         {
             string info = SErrorCode.GetEnumDisplayName(typeof(Software), Software.Parser);
             info += ":" + FileName1;
             MessageBox.Show(info, ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
     }
     else
     {
         string info = "必须选择俩个文件,而且是不同的.";                //SErrorCode.GetEnumDisplayName(typeof(Software),Software.Parser);
         MessageBox.Show(info, ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #9
0
        public AboutForm_AllWin_JetRix(string vtext)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

            //if (vtext.Trim()==string.Empty||vtext.Trim()== null)
            //    m_LabelVersion.Text =
            //                    GetPanelVersion() + GetBoardVersion() +
            //                    GetPrintArea() + GetTimerInfo() + GetLangInfo();
            //else
            //    m_LabelVersion.Text = vtext;
            m_LabelVersion.Text = GetPanelVersion() + GetBoardVersion() +
                                  GetPrintArea() + GetTimerInfo() + GetLangInfo();

#if LIYUUSB
            string iconpath = Application.StartupPath;
            iconpath += "\\setup\\app.png";
            if (File.Exists(iconpath))
            {
                this.m_PictureBoxLogo.Image = Image.FromFile(iconpath, false);               // icon.ToBitmap();
            }

            m_ButtonHelp.Visible            = false;
            m_LabelCopyRight.Text           = ResString.GetResString("JHFCopyRightString");
            m_LabelCopyRight.Visible        = false;
            this.m_LabelVersion.BorderStyle = BorderStyle.Fixed3D;
            //this.panel1.BackgroundImageLayout = ImageLayout.Stretch;
            this.panel1.BackgroundImage   = null;
            this.panel1.BorderStyle       = BorderStyle.None;
            this.m_ButtonCopyInfo.Visible = false;
#endif
            this.Text = ResString.GetProductName() + vtext;
            //string iconpath = Application.StartupPath;
            //iconpath += "\\setup\\app.ico";
            //if (File.Exists(iconpath))
            //{
            //    m_PictureBoxLogo.Image = Image.FromFile(iconpath);
            //}
            SetQaPass();
        }
예제 #10
0
파일: Form1.cs 프로젝트: 6555355/Scan_yan1
        static void Main()
        {
            // enable XP theme support
            Application.EnableVisualStyles();
            Application.DoEvents();

            const string MUTEX      = CoreConst.c_MUTEX_App;
            bool         createdNew = false;
            Mutex        mutex      = new Mutex(true, MUTEX, out createdNew);

            if (!createdNew)
            {
                MessageBox.Show(ResString.GetEnumDisplayName(typeof(UIError), UIError.OnlyOneProgram));
                mutex.Close();
                return;
            }

#if EpsonLcd
            int lcid = PubFunc.GetLanguage();
            if (lcid == -1)
            {
                // 未连接usb线,无法获取软件语言,启动终止.
                MessageBox.Show(ResString.GetResString("NoFoundUSBReturn"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
#else
            AllParam cur  = new AllParam();
            int      lcid = cur.GetLanguage();
#endif
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(lcid);

#if true
            PrinterWrite mainWin = new PrinterWrite();
            if (mainWin.Start())
            {
                Application.Run(mainWin);
            }
#else
            FormHeadBoard hb = new FormHeadBoard();
            Application.Run(hb);
#endif

            mutex.Close();
        }
예제 #11
0
        private bool InvalidCheck()
        {
            AllParam allp    = m_iPrinterChange.GetAllParam();
            float    pgW     = allp.PrinterSetting.sBaseSetting.fPaperWidth;
            float    pgH     = allp.PrinterSetting.sBaseSetting.fPaperHeight;
            float    realPgW = PubFunc.CalcRealJobWidth(pgW, this.m_iPrinterChange.GetAllParam());

            float  JobW = this.m_PreviewJob.JobSize.Width;
            string info = string.Empty;

            if (JobW > realPgW)
            {
                info += SErrorCode.GetResString("Software_MediaTooSmall");
                MessageBox.Show(info, ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }
            return(true);
        }
예제 #12
0
        public void SetPrinterStatusChanged(JetStatusEnum status)
        {
            PrinterOperate po = PrinterOperate.UpdateByPrinterStatus(status);

            if (bSelfRaised && status == JetStatusEnum.Measuring)
            {
                bMeasuring  = true;
                bSelfRaised = false;
            }
            if (bMeasuring && status == JetStatusEnum.Ready &&
                !bAutoMeasure    //不是自动测高,或者自动测高已经更新了结果
                )
            {
                bSelfRaised = bMeasuring = false;
                if (IsMeasureBeforePrint)
                {
                    string       m1        = ResString.GetEnumDisplayName(typeof(Confirm), Confirm.PrintNow);
                    DialogResult result    = MessageBox.Show(m1, ResString.GetProductName(), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    csEventArgs  eventArgs = new csEventArgs()
                    {
                        Case = _case, Dr = DialogResult.Cancel
                    };
                    if (result == DialogResult.Yes)
                    {
                        eventArgs.Dr = DialogResult.OK;
                    }
                    //CoreInterface.SendJetCommand((int)JetCmdEnum.BackToHomePoint, (int)AxisDir.X);
                    OnCustomButtonClicked(null, eventArgs);
                }
                else
                {
                    string       m1     = ResString.GetEnumDisplayName(typeof(Confirm), Confirm.GoHome);
                    DialogResult result = MessageBox.Show(m1, ResString.GetProductName(), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result != DialogResult.No)
                    {
                        CoreInterface.SendJetCommand((int)JetCmdEnum.BackToHomePoint, (int)AxisDir.X);
                    }
                }
            }
            this.buttonCancel.Enabled                  = po.CanMoveStop;
            this.m_ButtonManualMove.Enabled            =
                this.m_ButtonMeasureThick.Enabled      =
                    this.m_ButtonMeasureThick2.Enabled = po.CanMoveUp && po.CanMoveDown;
        }
예제 #13
0
        private void m_ButtonHelp_Click(object sender, System.EventArgs e)
        {
//			Process process = Process.GetCurrentProcess();
//			DirectoryInfo dirInfo = Directory.GetParent(process.MainModule.FileName);
//			return dirInfo.FullName;
            string helpFileNutrual = Application.StartupPath;
            string helpFile        = helpFileNutrual +
                                     Path.DirectorySeparatorChar +
                                     Thread.CurrentThread.CurrentUICulture.Name +
                                     Path.DirectorySeparatorChar +
                                     "Help.pdf";

            helpFileNutrual += Path.DirectorySeparatorChar + "Manual.pdf";


            if (File.Exists(helpFile))
            {
                Process.Start(helpFile, ".pdf");
                //if(!StartReadFileProcess(helpFile,".pdf"))
                //{
                //    string msgInfo = ResString.GetEnumDisplayName(typeof(UIError),UIError.NoAcrobat);
                //    MessageBox.Show(msgInfo,ResString.GetProductName(),MessageBoxButtons.OK,MessageBoxIcon.Information);
                //    return;
                //}
            }
            else if (File.Exists(helpFileNutrual))
            {
                Process.Start(helpFileNutrual, ".pdf");
                //if(!StartReadFileProcess(helpFileNutrual,".pdf"))
                //{
                //    string msgInfo = ResString.GetEnumDisplayName(typeof(UIError),UIError.NoAcrobat);
                //    MessageBox.Show(msgInfo,ResString.GetProductName(),MessageBoxButtons.OK,MessageBoxIcon.Information);
                //    return;
                //}
            }
            else
            {
                string msgInfo = ResString.GetEnumDisplayName(typeof(UIError), UIError.NoHelpFile);
                MessageBox.Show(msgInfo, ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            return;
        }
예제 #14
0
        public MeasureQuestionForm(IPrinterChange ipc, bool isMeasureBeforePrint = false)
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
            this.Text             = ResString.GetProductName();
            this.frmMessage.Image = SystemIcons.Question.ToBitmap();
            this.frmMessage.Text  = SErrorCode.GetResString("COMCommand_Abort_NotifyMeasure");
            mIPrinterChange       = ipc;
            AllParam allp = mIPrinterChange.GetAllParam();

            checkBoxShowAttention.Visible = SPrinterProperty.IsFloraUv() && allp.PrinterProperty.IsZMeasurSupport;

            _isMeasureBeforePrint = zAixsSetting1.IsMeasureBeforePrint = isMeasureBeforePrint;

            zAixsSetting1.CustomButtonClicked += new EventHandler <Setting.csEventArgs>(zAixsSetting1_CostomButtonClicked);
        }
예제 #15
0
        private void m_ButtonCopyInfo_Click(object sender, System.EventArgs e)
        {
            SaveFileDialog fileDialog = new SaveFileDialog();

            fileDialog.OverwritePrompt  = true;
            fileDialog.DefaultExt       = ".zip";
            fileDialog.Filter           = @"Text Files (*.zip)|*.zip";//ResString.GetEnumDisplayName(typeof(FileFilter),FileFilter.Txt);
            fileDialog.InitialDirectory = Application.StartupPath;

            if (fileDialog.ShowDialog(this) == DialogResult.OK)
            {
                if (SaveVersionInfo(fileDialog.FileName) == 0)
                {
                    MessageBox.Show(this, ResString.GetEnumDisplayName(typeof(UIError), UIError.SaveAboutFail),
                                    ResString.GetProductName());
                }
                else
                {
                    MessageBox.Show(this, ResString.GetEnumDisplayName(typeof(UISuccess), UISuccess.SaveAboutSuccess),
                                    ResString.GetProductName());
                }
            }
        }
예제 #16
0
        public AboutForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
#if !LIYUUSB
            m_LabelVersion.Text = GetPanelVersion() + GetBoardVersion() +
                                  GetPrintArea() + GetTimerInfo() + GetLangInfo() + GetHeadBoardSN();
#endif
            this.Text = ResString.GetProductName();
            string iconpath = Application.StartupPath;
            iconpath += "\\setup\\app.ico";
            if (File.Exists(iconpath))
            {
                m_PictureBoxLogo.Image = Image.FromFile(iconpath);
            }
            SetQaPass();
        }
예제 #17
0
파일: Form1.cs 프로젝트: 6555355/Scan_yan1
        protected override void WndProc(ref Message m)
        {
            try
            {
                if (((int)m.WParam.ToInt64()) == 0xF060)                //   关闭消息
                {
                    string info = ResString.GetEnumDisplayName(typeof(Confirm), Confirm.Exit);
                    if (MessageBox.Show(info, ResString.GetProductName(), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                base.WndProc(ref m);

                if (m.Msg == this.m_KernelMessage)
                {
                    ProceedKernelMessage(m.WParam, m.LParam);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #18
0
        private int SaveVersionInfo(string sFileName)
        {
            int        ret = 0;
            FileStream fs  = null;;

            try
            {
                //只保存关于窗口中的信息
                //fs = new FileStream(sFileName, FileMode.Create);
                //if(fs != null && m_LabelVersion.Text != null && m_LabelVersion.Text.Length != 0)
                //{
                //    fs.Write(System.Text.Encoding.ASCII.GetBytes(m_LabelVersion.Text), 0, m_LabelVersion.Text.Length);
                //    ret = 1;
                //}

                //修改于2018-5-10 压缩保存相关信息
                using (FileStream fsOut = File.Create(sFileName))
                {
                    using (ZipOutputStream zipStream = new ZipOutputStream(fsOut))
                    {
                        bool            bPowerOn      = CoreInterface.GetBoardStatus() != JetStatusEnum.PowerOff;
                        HEAD_BOARD_TYPE headBoardType = (HEAD_BOARD_TYPE)CoreInterface.get_HeadBoardType(bPowerOn);
                        string          info          = m_LabelVersion.Text +
                                                        "HEAD_BOARD_TYPE: " + headBoardType + "\n" +
                                                        "BOARD_SYSTEM: " + (CoreInterface.IsS_system() ? "S" : "A+" + "\n" +
                                                                            "PRINT_HEAD_TYPE: " + Text.Replace(ResString.GetProductName(), "") + "\n");


                        byte[]   aboutStr   = Encoding.Default.GetBytes(info);
                        ZipEntry aboutEntry = new ZipEntry("About.txt")
                        {
                            DateTime = DateTime.Now
                        };
                        zipStream.PutNextEntry(aboutEntry);
                        zipStream.Write(aboutStr, 0, aboutStr.Length);
                        zipStream.CloseEntry();

                        string printfile = Path.Combine(Application.StartupPath, "Print.log");
                        Zip(printfile, zipStream);

                        string logfile = Path.Combine(Application.StartupPath, "log.txt");
                        Zip(logfile, zipStream);

                        string usersettingfile = Path.Combine(Application.StartupPath, "UserSetting.ini");
                        Zip(usersettingfile, zipStream);

                        string settingfile = Path.Combine(Application.StartupPath, "Setting.xml");
                        Zip(settingfile, zipStream);

                        if (GlobalSetting.Instance.VendorProduct != null && GlobalSetting.Instance.VendorProduct.Length >= 8)
                        {
                            string folderName = Path.Combine(Application.StartupPath,
                                                             GlobalSetting.Instance.VendorProduct.Substring(0, 4),
                                                             GlobalSetting.Instance.VendorProduct.Substring(4, 4));
                            CompressFolder(folderName, zipStream);

                            string factorywritefile = Application.StartupPath +
                                                      Path.DirectorySeparatorChar + "PrinterProductList_"
                                                      + GlobalSetting.Instance.VendorProduct.Substring(4, 4) + ".xml";
                            Zip(factorywritefile, zipStream);
                        }



                        zipStream.IsStreamOwner = false;
                        zipStream.Finish();
                        zipStream.Close();
                        ret = 1;
                    }
                }
            }
            catch {}
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }
            return(ret);
        }
예제 #19
0
        public void FirstReadyShakeHand()
        {
#if ADD_HARDKEY
            ushort Vid, Pid;
            Vid = Pid = 0;

            bool   result = true;
            byte[] infos  = new byte[19];
            if (CoreInterface.GetProductID(ref Vid, ref Pid) == 0)
            {
                result = false;
            }
            else
            {
                BYHX_SL_RetValue ret = BYHXSoftLock.GetDongleInfo(ref infos, BYHXSoftLock.FIRST_S4_INDEX);
                if (ret != BYHX_SL_RetValue.SUCSESS)
                {
                    result = false;
                }
                else
                {
                    ConvertAToB(infos);
                    ushort dogVid = BitConverter.ToUInt16(infos, 16);
                    //if ((Vid&0x7F) != (infos[16] & 0x7f))//模糊检查
                    //if (Vid != (infos[16] & 0x7f)) //BUG
                    if (Vid != dogVid) //严格检查
                    {
                        result = false;
#if LIYUUSB
                        if (infos[16] == 7 && Vid == (ushort)VenderID.LOTUS)
                        {
                            result = true;
                        }
#endif
                        if ((Vid & 0x807F) == (dogVid & 0x807f))
                        {
                            //if ((Vid & 0x7F) == (ushort)VenderID.GONGZENG)
                            result = true;
                        }
                    }
                }
            }
            if (result != bMatchVender)
            {
                bMatchVender = result;
//				m_IPrinterChange.OnPrinterStatusChanged(JetStatusEnum.PowerOff);
            }
            if (result == false)
            {
                MessageBox.Show(ResString.GetResString("EncryptDog_VidNotMatch"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

#if false
            //This is for Dog Check Board
            byte[] info = new byte[64];
            info[0] = (byte)(Vid & 0xff);
            info[1] = (byte)((Vid >> 8) & 0xff);
            info[2] = (byte)(Pid & 0xff);
            info[3] = (byte)((Pid >> 8) & 0xff);
            ret     = BYHXSoftLock.SetProductInfo(info, 32);
            if (ret != BYHX_SL_RetValue.SUCSESS)
            {
#if DEBUG
                //if (stDataPkgOut.tag != S4_API.S4_SUCCESS)
                {
                    MessageBox.Show("SetProductInfo Run failed!");
                }
#endif
            }
#endif
            //infos[16] = (byte)(Vid & 0xff);
            CoreInterface.SetDspPwmInfo(infos, infos.Length);
#endif
        }
예제 #20
0
        private void buttonConfirm_Click(object sender, EventArgs e)
        {
            string passWordStr = textBoxPassWord.Text.Trim();

            if (passWordStr != string.Empty)
            {
                int passWord;
                if (int.TryParse(passWordStr, out passWord))
                {
                    SBoardInfo sBoardInfo = new SBoardInfo();
                    if (CoreInterface.GetBoardInfo(0, ref sBoardInfo) != 0)
                    {
                        string filePath = InkAreaStaticsHelper.GetInkStaticsFileName((uint)(passWord / sBoardInfo.m_nBoardManufatureID));
                        if (passWord == sBoardInfo.m_nBoardSerialNum * sBoardInfo.m_nBoardManufatureID)
                        {
                            InkAreaStaticsHelper.ClearInkQuantity();
                            InkAreaStaticsHelper.ClearPrintArea();
                            //新建文件
                            if (InkAreaStaticsHelper.SynchronizeInkAndArea())
                            {
                                MessageBox.Show(ResString.GetResString("SynchronizeInkAndAreaSuccess"),
                                                ResString.GetProductName());
                                flag = 1;
                                Close();
                            }
                            else
                            {
                                labelTips.Text = "Tips:Synchronization error!";
                            }
                        }
                        else if (File.Exists(filePath))
                        {
                            //同步文件
                            FileStream   fs   = new FileStream(filePath, FileMode.Open);
                            BinaryReader br   = new BinaryReader(fs);
                            byte[]       ink  = new byte[Marshal.SizeOf(typeof(InkOfMonths))];
                            byte[]       area = new byte[Marshal.SizeOf(typeof(AreaOfMonths))];
                            ink  = br.ReadBytes(ink.Length);
                            area = br.ReadBytes(area.Length);
                            if (InkAreaStaticsHelper.SetInkQuantity(ink) && InkAreaStaticsHelper.SetPrintArea(area))
                            {
                                MessageBox.Show(ResString.GetResString("SynchronizeInkAndAreaSuccess"),
                                                ResString.GetProductName());
                                flag = 1;
                                Close();
                            }
                            else
                            {
                                labelTips.Text = "Tips:Synchronization error!";
                            }
                            fs.Close();
                        }
                        else
                        {
                            labelTips.Text = "Tips:Synchronization error!";
                        }
                    }
                    else
                    {
                        labelTips.Text = "Tips:Get BoardInfo error!";
                    }
                }
                else
                {
                    labelTips.Text = "Tips:Input error!";
                }
            }
        }
예제 #21
0
        public void OnPrinterSettingChange(SPrinterSetting ss)
        {
            try
            {
                m_PrinterSetting = ss;
                SZSetting zseting = ss.ZSetting;
                if (bLoaded && bAutoMeasure)
                {
                    ByhxZMoveParam param;
                    if (ScorpionCoreInterface.GetByhxZMoveParam(out param))
                    {
                        float zMaxPos1 = ss.ZSetting.fMesureMaxLen;
                        if (zMaxPos1 <= 0)
                        {
                            MessageBox.Show(ResString.GetResString("StrMesureResultError"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        float fZSpace    = ss.ZSetting.fHeadToPaper;
                        float paperThick = ss.sExtensionSetting.zMaxLength - zMaxPos1;//
                        if (paperThick >= 0)
                        {
                            ss.sBaseSetting.fPaperThick = paperThick; //同步参数到设置窗口
                        }
                        else
                        {
                            if (Math.Abs(paperThick) < 0.001f)
                            {
                                ss.sBaseSetting.fPaperThick = 0;
                            }
                            else
                            if (!SPrinterProperty.IsYUEDA())
                            {
                                MessageBox.Show(ResString.GetResString("StrZMaxTooShort"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                        }
                        ss.sBaseSetting.fZSpace = fZSpace; //同步参数到设置窗口
                    }
                    //更新测高结果
                    //numericUpDownZMax.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen);
                    //numericUpDownSensorPosZ.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ);

                    bAutoMeasure = false;
                    SetPrinterStatusChanged(CoreInterface.GetBoardStatus()); //参数更新后触发回原点提示
                }
                else
                {
                    numericUpDownZspace.Value       = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fHeadToPaper);
                    numericUpDownZspeed.Value       = (decimal)zseting.fMeasureSpeedZ;
                    numericUpDownMesureHeight.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureHeight);
                    //numericUpDownZMax.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen);
                    //numericUpDownMesureXCoor.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureXCoor);
                    //numericUpDownSensorPosZ.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ);
                    //numericUpDown7.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureYCoor);
                    numericUpDown8.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.reserve1);

                    decimal x = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureXCoor);
                    if (x > numericUpDownMesureXCoor.Maximum || x < numericUpDownMesureXCoor.Minimum)
                    {
                        numericUpDownMesureXCoor.Value = numericUpDownMesureXCoor.Minimum;
                    }
                    else
                    {
                        numericUpDownMesureXCoor.Value = x;
                    }

                    decimal y = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureYCoor);
                    if (y > numericUpDown7.Maximum || y < numericUpDown7.Minimum)
                    {
                        numericUpDown7.Value = numericUpDown7.Minimum;
                    }
                    else
                    {
                        numericUpDown7.Value = y;
                    }
                }

                if ((decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen) > numericUpDownZMax.Maximum || (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen) < numericUpDownZMax.Minimum)
                {
                    numericUpDownZMax.Value = 0;
                }
                else
                {
                    numericUpDownZMax.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fMesureMaxLen);
                }
                if ((decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ) > numericUpDownSensorPosZ.Maximum || (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ) < numericUpDownSensorPosZ.Minimum)
                {
                    numericUpDownSensorPosZ.Value = 0;
                }
                else
                {
                    numericUpDownSensorPosZ.Value = (decimal)UIPreference.ToDisplayLength(m_CurrentUnit, zseting.fSensorPosZ);
                }

                UIPreference.SetValueAndClampWithMinMax(m_NumericUpDownThickness, m_CurrentUnit, ss.sBaseSetting.fPaperThick);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #22
0
 private void m_ButtonOK_Click(object sender, System.EventArgs e)
 {
     if (m_bNewXaar382 && this.xaarTempertureSetting1.IsDirty)
     {
         DialogResult dr = MessageBox.Show(ResString.GetResString("Xaar382_UnsavedWarning"), ResString.GetProductName(), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dr == DialogResult.No)
         {
             this.DialogResult = DialogResult.None;
         }
     }
 }
예제 #23
0
 private void RealTimeChart_Load(object sender, EventArgs e)
 {
     this.Text = ResString.GetProductName();
 }
예제 #24
0
        private void button_Font_Click(object sender, System.EventArgs e)
        {
            FontDialog fontDialog1 = new FontDialog();

            fontDialog1.Font               = this.textBoxFootNote.Font;// new Font(font.Name, size);
            fontDialog1.AllowSimulations   = false;
            fontDialog1.AllowVectorFonts   = false;
            fontDialog1.AllowVerticalFonts = false;
            fontDialog1.FontMustExist      = true;
            try
            {
                if (fontDialog1.ShowDialog() == DialogResult.OK)
                {
                    this.textBoxFootNote.Font = fontDialog1.Font;
                    OnClipSettingChanged(sender, e);
                }
            }
            catch
            {
                MessageBox.Show(ResString.GetResString("RulerConstantSeting_UnsupportedFont"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #25
0
        public static bool NCButtonClick(Message m, Form mform, bool isMainForm)
        {
            if (!loadSucessed)
            {
                return(true);
            }
            if (!CanDrawFormHeader)
            {
                return(true);
            }

            //			if(m.Msg != 0xA1) return;
            SizeF szIcon          = new SizeF(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CXSMICON));
            int   xSizeFrame      = SystemInformation.FrameBorderSize.Width;  //GetSystemMetrics(SM_CXSIZEFRAME)
            int   ySizeFrame      = SystemInformation.FrameBorderSize.Height; //GetSystemMetrics(SM_CYSIZEFRAME)
            int   iCaptionH       = SystemInformation.CaptionHeight;          //GetSystemMetrics(SM_CYCAPTION)
            SizeF szCaptionButton = SystemInformation.CaptionButtonSize;      //new SizeF(GetSystemMetrics(SM_CXSIZE),GetSystemMetrics(SM_CYSIZE))
            int   xBorder         = SystemInformation.Border3DSize.Width;     //GetSystemMetrics(SM_CXBORDER)
            int   yBorder         = SystemInformation.Border3DSize.Height;    //GetSystemMetrics(SM_CYBORDER)

            //重新计算按钮位置
            ReCALCButtonRectangle(mform, SystemInformation.FrameBorderSize, SystemInformation.Border3DSize, szCaptionButton);

            switch (m.Msg)
            {
            case 0xA3:                    //WM_NCLBUTTONDBLCLK
            {
                // 屏蔽自画按钮的双击事件
                Point mousePoint = new Point((int)m.LParam);
                mousePoint.Offset(-mform.Left, -mform.Top);
                if (isMainForm)
                {
                    if (                           //m_rect.Contains(mousePoint) ||
                        m_rectMin.Contains(mousePoint) || m_rectMax.Contains(mousePoint))
                    {
                        return(false);
                    }
                }
                if (m_rectClo.Contains(mousePoint))
                {
                    return(false);
                }
                break;
            }

            case 0xA1:                    //WM_NCLBUTTONDOWN
                #region                   //WM_NCLBUTTONDOWN
            {
                Point mousePoint = new Point((int)m.LParam);
                mousePoint.Offset(-mform.Left, -mform.Top);

                if (isMainForm)
                {
//						if(m_rect.Contains(mousePoint))
//						{
//							//画自定义按钮
////							DrawCustomButton(m,mform,ButtonState.Pushed,imgBtnCustom,m_rect);
//
//							bMainMenu_Visible = !bMainMenu_Visible;
//							for(int i = 0;i < mform.Menu.MenuItems.Count;i++)
//								mform.Menu.MenuItems[i].Visible = bMainMenu_Visible;
//						}

                    if (m_rectMin.Contains(mousePoint))
                    {
//							DrawMyCaptionButton(m,mform,ButtonState.Pushed,imgBtnMin,m_rectMin);
                        mform.WindowState = FormWindowState.Minimized;
                        return(false);
                    }

                    if (m_rectMax.Contains(mousePoint))
                    {
                        if (mform.WindowState == FormWindowState.Maximized)
                        {
//								DrawMyCaptionButton(m,mform,ButtonState.Pushed,imgBtnRes,m_rectMax);
                            mform.WindowState = FormWindowState.Normal;
                        }
                        else
                        {
//								DrawMyCaptionButton(m,mform,ButtonState.Pushed,imgBtnMax,m_rectMax);
                            mform.WindowState = FormWindowState.Maximized;
                        }
                        return(false);
                    }
                    if (rcIcon.Contains(mousePoint))
                    {
                        Point     vPoint;
                        Rectangle vRect;
                        GetCursorPos(out vPoint);
                        Form sf = new Form();
                        sf.WindowState = mform.WindowState;
                        SendMessage(mform.Handle, WM_SYSCOMMAND, TrackPopupMenu(
                                        GetSystemMenu(sf.Handle, false),
                                        TPM_RETURNCMD | TPM_LEFTBUTTON, vPoint.X, vPoint.Y,
                                        0, mform.Handle, out vRect), 0);
                        sf.Dispose();
                    }
                }
                if (m_rectClo.Contains(mousePoint))
                {
//						DrawMyCaptionButton(m,mform,ButtonState.Pushed,imgBtnClose,m_rectClo);
                    if (isMainForm)
                    {
                        string info = ResString.GetEnumDisplayName(typeof(Confirm), Confirm.Exit);
                        if (MessageBox.Show(info, ResString.GetProductName(), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                        {
                            return(false);
                        }
                    }
                    mform.Close();
                }
                break;
            }
                #endregion
            }
            return(true);
        }
예제 #26
0
        private bool GetRealTimeInfo2()
        {
            bool ret = false;

            infoList = new RealTimeDataOneHead[m_HeadNum];
            uint rmask = 0;

            rmask |= 1 << (int)EnumVoltageTemp.TemperatureCur;
            int headNum = 0;

            int size = Marshal.SizeOf(typeof(RealTimeDataOneHead));

            byte[] InfosBytes = new byte[m_HeadNum * size];

            IntPtr infosIntptr = Marshal.AllocHGlobal(size * m_HeadNum);

            try
            {
                if (CoreInterface.GetRealTimeInfo2(infosIntptr, ref headNum, rmask) != 0)
                {
                    for (int i = 0; i < m_HeadNum; i++)
                    {
                        IntPtr ptr = (IntPtr)(infosIntptr.ToInt64() + i * size);
                        infoList[i] = (RealTimeDataOneHead)Marshal.PtrToStructure(ptr, typeof(RealTimeDataOneHead));
                    }
                }
                else
                {
                    MessageBox.Show(ResString.GetEnumDisplayName(typeof(UIError), UIError.GetRealTimeInfoFail), ResString.GetProductName());
                    return(false);
                }
                ret = true;
            }
            finally
            {
                Marshal.FreeHGlobal(infosIntptr);
            }

            return(ret);
        }
예제 #27
0
파일: Main.cs 프로젝트: 6555355/Scan_yan1
        static void Main(string[] args)
        {
#if EpsonLcd
            bool showUI = true;
            try
            {
                if (args != null && args.Length > 0)
                {
                    showUI = bool.Parse(args[0]);
                }
            }
            catch
            {
//				showUI = false;
            }
#endif
            // enable XP theme support
            Application.EnableVisualStyles();
            Application.DoEvents();

            //SetLanguage();
            //Chinese XP system
            if (((System.Globalization.CultureInfo.InstalledUICulture.LCID & 0xff) == 04) &&
                System.Environment.OSVersion.Version.Major == 5 &&
                System.Environment.OSVersion.Version.Minor == 1)
            {
                string filename = System.Environment.SystemDirectory + Path.DirectorySeparatorChar
                                  + "conime.exe";
                if (File.Exists(filename))
                {
                    System.Diagnostics.ProcessStartInfo Info = new  System.Diagnostics.ProcessStartInfo();
                    Info.FileName = filename;

                    System.Diagnostics.Process Proc;
                    try
                    {
                        Proc = System.Diagnostics.Process.Start(Info);
                    }
                    catch                    //(System.ComponentModel.Win32Exception  e)
                    {
                        return;
                    }
                    //等待3秒钟
                    //Proc.WaitForExit(3000);
                }
            }

            const string MUTEX      = CoreConst.c_MUTEX_App;
            bool         createdNew = false;
            Mutex        mutex      = new Mutex(true, MUTEX, out createdNew);
            if (!createdNew)
            {
#if EpsonLcd
                Process process = RuningInstance();
                MyData  data    = ProcessMessaging.GetShareMem(); //您new一个也行
                data.InfoCode  = showUI?1:0;                      //消息码
                data.ProcessID = process.Id;                      //接收进程ID
                ProcessMessaging.SetShareMem(data);
                Thread.Sleep(100);
                return;
#else
                MessageBox.Show(ResString.GetEnumDisplayName(typeof(UIError), UIError.OnlyOneProgram));
                mutex.Close();
                return;
#endif
            }

#if EpsonLcd
            int lcid = PubFunc.GetLanguage();
            if (lcid == -1)
            {
                // 未连接usb线,无法获取软件语言,启动终止.
                MessageBox.Show(ResString.GetResString("NoFoundUSBReturn"), ResString.GetProductName(), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
#else
            AllParam cur  = new AllParam();
            int      lcid = cur.GetLanguage();
#endif

            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(lcid);

            bool splashEnable = PubFunc.GetEnableSplash();
            if (splashEnable)
            {
                Splasher.ShowSplash(1000);
            }

            string skinName = cur.GetSkinName();

#if EpsonLcd
            MainForm mainWin = new MainForm(showUI);
#else
            MainForm mainWin = new MainForm(true, skinName);
#endif
            Application.AddMessageFilter(mainWin);
            if (mainWin.Start())
            {
                Application.Run(mainWin);
            }
            mutex.Close();
        }
예제 #28
0
 private void OnRealTimeChange()
 {
     //SRealTimeCurrentInfo info = new SRealTimeCurrentInfo();
     //uint rmask = 0;
     //rmask |= 1 << (int)EnumVoltageTemp.TemperatureCur;
     if (GetRealTimeInfo2())
     {
         if (_infos.Count >= chart_Temperature.ChartAreas[0].AxisX.Maximum)
         {
             _infos.RemoveAt(0);
         }
         _infos.Add(infoList);
         ChartTemperatureReload();
     }
     else
     {
         timer_RealTime.Enabled = false;
         MessageBox.Show(ResString.GetEnumDisplayName(typeof(UIError), UIError.GetRealTimeInfoFail), ResString.GetProductName());
     }
 }