Example #1
0
        private void IndexWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            DateTime start = DateTime.Now;
            DateTime now   = DateTime.Now;
            TimeSpan ts    = now - start;

            while (true)
            {
                ts = now - start;
                //1秒后
                if (ts.TotalSeconds > 1)
                {
                    if (YYKeyenceReaderConsole.getForm() != null)
                    {
                        //关闭读码器
                        YYKeyenceReaderConsole.codeReaderOff();
                    }
                    break;
                }
                else
                {
                    now = DateTime.Now;
                }
            }
            if (MainWindow.getForm() != null)
            {
                //关闭录像机
                MainWindow.stopRecordVideo();
            }
        }
Example #2
0
 private void 读码器设置ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         //打开读码器设置窗体
         YYKeyenceReaderConsole.getForm().Show();
     }
     catch (Exception ex) {
         MessagePrompt.Show("打开读码器设置页面时出错,错误信息:" + ex.Message);
     }
 }
Example #3
0
 private IndexWindow()
 {
     InitializeComponent();
     try
     {
         //获取模糊查询所需要的参数
         getSearchParam();
         //获取螺纹检验记录
         getThreadingProcessData();
         //设置datagridView字体
         this.dataGridView1.RowsDefaultCellStyle.Font = new Font("宋体", 18, FontStyle.Bold);
         DataGridViewCellStyle style = new DataGridViewCellStyle();
         style.Font = new Font("宋体", 18, FontStyle.Bold);
         //设置datagridView列和头部样式
         foreach (DataGridViewColumn col in this.dataGridView1.Columns)
         {
             col.HeaderCell.Style = style;
         }
         this.dataGridView1.EnableHeadersVisualStyles = false;
         myForm = this;
         //开启上传视频线程
         thread = new Thread(UploadVideo);
         thread.Start();
         thread.IsBackground = true;
     }
     catch (Exception e)
     {
         //thread.Abort();
     }
     finally {
         try
         {
             //初始化录像窗体
             MainWindow.getForm();
             //开启录像机
             if (MainWindow.recordStatus == 0)
             {
                 MainWindow.getForm().btnLogin_Click(null, null);
             }
             if (MainWindow.recordStatus == 1)
             {
                 MainWindow.getForm().btnPreview_Click_1(null, null);
             }
             //初始化读码器窗体
             YYKeyenceReaderConsole.getForm();
             //连接读码器
             if (YYKeyenceReaderConsole.readerStatus == 0)
             {
                 YYKeyenceReaderConsole.codeReaderConnect();
             }
             YYKeyenceReaderConsole.getForm().Show();
             YYKeyenceReaderConsole.getForm().Hide();
             //开启读码器,此处开启无法读码
             //if (YYKeyenceReaderConsole.readerStatus == 1)
             //    YYKeyenceReaderConsole.codeReaderLon();
             //初始化螺纹检验表单窗体
             ThreadingForm.getMyForm();
         }
         catch (Exception ex) {
             MessagePrompt.Show("初始化窗体异常,异常信息:" + ex.Message);
         }
     }
 }