コード例 #1
0
        ///// <summary>
        ///// 打开标定控件
        ///// </summary>
        //public void OpenCalibrationView()
        //{
        //    try
        //    {
        //        if ((Scene?.VisionFrame.IsEnableCamera == true) && (string.IsNullOrEmpty(SelectedCamera?.Info?.SerialNumber)))
        //        {
        //            throw new DriveNotFoundException("没有选定相机");
        //        }

        //        //var view = new CalibrationView();
        //        //var viewModel = (view.DataContext as CalibrationViewModel);
        //        //viewModel.CalibrationConfigurationCompleted -= ViewModel_CalibrationConfigurationCompleted;
        //        //viewModel.CalibrationConfigurationCompleted += ViewModel_CalibrationConfigurationCompleted;

        //    }
        //    catch (Exception ex)
        //    {
        //        OnMessageRaised(MessageLevel.Err, ex.Message, ex);
        //    }
        //}

        //private void ViewModel_CalibrationConfigurationCompleted(object sender, CalibrationConfigurationCompletedEventArgs e)
        //{

        //}

        /// <summary>
        /// 更新标定文件
        /// </summary>
        public void UpdateCalibrationFile()
        {
            //获取相机标定文件
            FileInfo[] calibrationFileInfos = CameraFactory.GetCameraCalibrationFiles(SelectedCamera?.Info.SerialNumber);
            CameraCalibrationFiles = new ObservableCollection <string>(calibrationFileInfos.ToList().ConvertAll(x => x.Name));
            CameraCalibrationFiles.Add("不需标定");
        }
コード例 #2
0
        /// <summary>
        /// 更新相机标定文件
        /// </summary>
        public void UpdateCameraCalibrationFiles()
        {
            try
            {
                if (IsSceneValid && Scene.VisionFrame.IsEnableCamera)
                {
                    FileInfo[] files = CameraFactory.GetCameraCalibrationFiles(Scene.Camera.Info.SerialNumber);
                    CalibrationConfigFiles = new ObservableCollection <string>(files.ToList().ConvertAll(x => x.Name));

                    if ((CalibrationConfigFiles.Count > 0) && (string.IsNullOrEmpty(CalibrationConfigFile)))
                    {
                        CalibrationConfigFile = CalibrationConfigFiles[0];
                    }
                }
            }
            catch (Exception ex)
            {
                OnMessageRaised(MessageLevel.Err, ex.Message, ex);
            }
        }