示例#1
0
        protected virtual void OpenSubjectFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.CheckFileExists    = true;
            openFileDialog.Filter             = "MVision文件|*.hal";
            openFileDialog.Title              = "打开MVision文件";
            openFileDialog.Multiselect        = false;
            openFileDialog.FileName           = null;
            openFileDialog.AutoUpgradeEnabled = true;
            try
            {
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    System.Windows.Forms.Application.DoEvents();
                    if (openFileDialog.SafeFileNames.Count() > 0)
                    {
                        if (openFileDialog.SafeFileNames[0].EndsWith(".hal") ||
                            openFileDialog.SafeFileNames[0].EndsWith(".HAL"))
                        {
                            string fileName = openFileDialog.FileNames[0];
                            var    acqObj   = HalSerializer.LoadObjectFormFile(fileName) as HalAcqFifoTool;
                            Subject = acqObj;
                        }
                        else
                        {
                            MessageBox.Show("选择的文件不是.hal格式的!", "提示");
                        }
                    }
                    else
                    {
                        MessageBox.Show("未选择文件!", "提示");
                    }
                }
            }
            finally
            {
                openFileDialog.Dispose();
                openFileDialog = null;
            }
        }
示例#2
0
        /// <summary>
        /// 打开相机
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_InitializeCamera_Click(object sender, EventArgs e)
        {
            string device     = (cmb_CameraList.Items[cmb_CameraList.SelectedIndex] as string).Split(':')[1];
            string colorspace = cmb_ColorSpace.Items[cmb_ColorSpace.SelectedIndex] as string;

            try
            {
                subject = new HalAcqFifoTool(new HTuple(device), colorspace);
                subject.AcqStateInfo.CameraLinkStateChanged += CameraLinkStateChanged;

                subject.Operator.OwnedExposureParam.Changed      += ExposureChanged;
                subject.Operator.OwnedBrightnessParam.Changed    += BrightnessChanged;
                subject.Operator.OwnedContrastParam.Changed      += ContrastChanged;
                subject.Operator.OwnedTriggerParam.Changed       += TriggerChnaged;
                subject.Operator.OwnedImagePropertyParam.Changed += ImagePropertyChanged;
                subject.Complete += GrabImageComplete;

                CameraLinkStateChanged(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#3
0
 public AcqForm(HalAcqFifoTool obj)
 {
     InitializeComponent();
     subject = obj;
 }