示例#1
0
        private void btnApplyCalibration_Click(object sender, EventArgs e)
        {
            if (VerificationBox.Show() != DialogResult.Yes)
            {
                return;
            }

            Rectifier.EditBlockInputParams((ObservableCollection <RectifiedParam>)dataGridView1.DataSource,
                                           new List <Tuple <string, string> >()
            {
                new Tuple <string, string>("Y1", "Y1Offset"),
                new Tuple <string, string>("Y2", "Y2Offset"),
                new Tuple <string, string>("Angle", "AngleOffset"),
                new Tuple <string, string>("m", "mX"),
            }, ref UVGlue._block);

            try
            {
                UVGlue.SaveVPP();
                UVGlue.BackupVPP();
                MessageBox.Show("应用并保存成功");
            }
            catch
            {
                MessageBox.Show("保存失败");
            }
        }
示例#2
0
        void backgroundprocess(object param)
        {
            FormStarting fs = (FormStarting)param;
            Action<string> fpAddItem = AddItem;

            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();

            string result;

            this.Invoke(fpAddItem, "加载视觉工具");
            try
            {
                UVGlue.LoadVPP();
                result = "成功";
                this.Invoke(fpAddItem, result);

                fs.DialogResult = DialogResult.OK;
                Action actClose = () => { fs.Close(); };
                fs.Invoke(actClose);
            }
            catch (Exception ex)
            {
                MessageBox.Show("视觉工具加载失败,请联系技术人员\r\n" + ex.Message);
                result = "失败";
                this.Invoke(fpAddItem, result);

                fs.DialogResult = DialogResult.Cancel ;
                Action actClose = () => { fs.Close(); };
                fs.Invoke(actClose);
            }

         
        }
示例#3
0
        private void FormModel_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason != CloseReason.UserClosing)
            {
                return;
            }

            var userResult = MessageBox.Show("是否保存修改", "关闭模板窗口", MessageBoxButtons.YesNo, MessageBoxIcon.Question,
                                             MessageBoxDefaultButton.Button1);

            if (userResult == DialogResult.Yes)
            {
                try
                {
                    UVGlue.SaveVPP();
                    MessageBox.Show("保存成功");
                }
                catch
                {
                    MessageBox.Show("保存失败");
                }
            }

            e.Cancel = true;
            Hide();
        }
示例#4
0
 private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (e.CloseReason == CloseReason.UserClosing)
     {
         var closeDecision = MessageBox.Show("是否退出", "正在退出", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (closeDecision == DialogResult.Yes)
         {
             UVGlue.JoinBackgroundThreads();
             UVGlue.cleanUp();
         }
         else
         {
             e.Cancel = true;
         }
     }
     else
     {
         UVGlue.JoinBackgroundThreads();
         UVGlue.cleanUp();
     }
 }
示例#5
0
 private void btnRun_Click(object sender, EventArgs e)
 {
     UVGlue.RunOnce();
 }