コード例 #1
0
        /// <summary>
        /// 更新数据到控制卡
        /// </summary>
        /// <param name="MarkData"></param>
        private void UpdataToBoard(string[,] MarkData)
        {
            int  m_nBufferCount    = -1;
            int  m_nTotalDataCount = MarkData.GetLength(0);
            bool m_bAddFinished    = false;

            while (true)
            {
                if (m_bUserStop)
                {
                    break;
                }
                m_nErr = LmcDll.ContinueBufferFlyGetParam(ref m_ntempFinish1, ref m_nBufferCount);//得到一次加工过程中,已经完成的加工数量
                if (m_nErr != 0)
                {
                    MessageBox.Show(m_nErr.ToString());
                    break;
                }
                if (m_ntempFinish1 > m_nNowFinish)
                {
                    m_nNowFinish = m_ntempFinish1;
                }

                if (m_nNowFinish == m_nTotalDataCount)
                {//全部完成
                    break;
                }
                if (m_nBufferCount < 8)
                {   //有空间
                    if (m_nUpdataToDLCBoardIndex < m_nTotalDataCount)
                    {
                        m_nErr = LmcDll.ContinueBufferFlyAdd(6, MarkData[m_nUpdataToDLCBoardIndex, 0], MarkData[m_nUpdataToDLCBoardIndex, 1], MarkData[m_nUpdataToDLCBoardIndex, 2], MarkData[m_nUpdataToDLCBoardIndex, 3], MarkData[m_nUpdataToDLCBoardIndex, 4], MarkData[m_nUpdataToDLCBoardIndex, 5]);
                        if (m_nErr != 0)
                        {
                            MessageBox.Show(m_nErr.ToString());
                        }
                        m_nUpdataToDLCBoardIndex++;
                    }
                    else
                    {//全部填充完毕
                        if (m_bAddFinished)
                        {
                            continue;
                        }
                        else
                        {
                            m_nErr = LmcDll.ContinueBufferPartFinish();
                            if (m_nErr != 0)
                            {
                                MessageBox.Show(m_nErr.ToString());
                            }
                            m_bAddFinished = true;
                        }
                    }
                }
                System.Threading.Thread.Sleep(1);
            }
            m_ntempFinish1 = 0;
        }
コード例 #2
0
 private void btnSetcfg_Click(object sender, EventArgs e)
 {
     m_nErr = LmcDll.SetDevCfg();
     if (m_nErr != 0)
     {
         MessageBox.Show(m_nErr.ToString());
     }
 }
コード例 #3
0
        /// <summary>
        /// 得到当前数据库里面数据的预览图片
        /// </summary>
        public static Image GetCurPreviewImage(int bmpwidth, int bmpheight)
        {
            IntPtr pBmp = GetCurPrevBitmap(bmpwidth, bmpheight);
            Image  img  = Image.FromHbitmap(pBmp);

            LmcDll.DeleteObject(pBmp);
            return(img);
        }
コード例 #4
0
 /// <summary>
 /// 释放板卡,对象管理器,开发库
 /// </summary>
 private void UnInitialBoard()
 {
     m_nErr = LmcDll.Close();
     if (m_nErr != 0)
     {
         MessageBox.Show("初始化失败" + m_nErr);
     }
     else
     {
         m_bIsInitial = false;
     }
 }
コード例 #5
0
 /// <summary>
 /// 初始化
 /// </summary>
 private void InitialBoard()
 {
     m_nErr = LmcDll.Initialize(Application.StartupPath, false);
     if (m_nErr != 0)
     {
         MessageBox.Show("初始化失败" + m_nErr);
     }
     else
     {
         m_bIsInitial = true;
     }
 }
コード例 #6
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     if (backgroundWorkerMark.IsBusy)
     {
         m_nErr = LmcDll.StopMark();
         if (m_nErr != 0)
         {
             MessageBox.Show(m_nErr.ToString());
         }
     }
     btnStart.Enabled  = true;
     btnSetcfg.Enabled = true;
 }
コード例 #7
0
        /// <summary>
        /// 刷新模板预览图
        /// </summary>
        public void ShowPreviewBmp()
        {
            int w = pictureBox1.Size.Width;
            int h = pictureBox1.Size.Height;

            if (w > h)
            {
                w = h;
            }
            else
            {
                h = w;
            }
            pictureBox1.Image = LmcDll.GetCurPreviewImage(w, h);
        }
コード例 #8
0
        private void btnOpenFile_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.InitialDirectory = Application.StartupPath;
            dlg.Filter           = "Ezd files (*.ezd)|*.ezd";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (LmcDll.LoadEzdFile(dlg.FileName) != 0)
                {
                    MessageBox.Show("打开Ezd文件" + dlg.FileName + "失败!");
                }
                else
                {
                    ShowPreviewBmp();
                }
            }
        }
コード例 #9
0
 private void backgroundWorkerMark_DoWork(object sender, DoWorkEventArgs e)
 {
     m_bFlyMarking = true;
     //设置需要更新的文本对象名称
     LmcDll.ContinueBufferSetTextName("T0", "T1", "T2", "T3", "T4", "T5");
     //清除缓存
     LmcDll.ContinueBufferClear();
     //启动数据更新
     backgroundWorkerUpDataMarkData.RunWorkerAsync();
     //执行连续加工
     m_nErr = LmcDll.ContinueBufferFlyStart();
     if (m_nErr != 0)
     {
         MessageBox.Show(m_nErr.ToString());
     }
     if (m_nTotalFinish == m_nNeedMarkTotal)
     {
         btnStart.Enabled  = true;
         btnSetcfg.Enabled = true;
         MessageBox.Show("加工完成");
     }
     m_bUserStop = true;
 }