/// <summary>
        /// 更新校正影像品質資訊
        /// </summary>
        public void UpdateCalibImageQualityIssue(string imageID)
        {
            //ToDo
            var model = new CalibImageViewModel() { CalibImageID = imageID };
            var eventArgs = new CalibrationEventArgs(model) { EventType = EventNotifyType.CalibrationImageQualityIssueChanged };
            var sender = this;

            eventNotify(sender, eventArgs);
        }
 private void eventNotify(object sender, CalibrationEventArgs e)
 {
     switch (e.EventType)
     {
         case EventNotifyType.CalibratedFileSave:
             if (On_CalibratedFileSaved != null)
                 On_CalibratedFileSaved(sender, e);
             break;
         case EventNotifyType.CalibrationCompletd:
             if (On_CalibrationCompleted != null)
                 On_CalibrationCompleted(sender, e);
             break;
         case EventNotifyType.CalibrationImageQualityIssueChanged:
             if (On_CalibrationImageQualityIssueChanged != null)
                 On_CalibrationImageQualityIssueChanged(sender, e);
             break;
         case EventNotifyType.CalibrationImageQualityIssueParamChanged:
             if (On_CalibrationImageQualityIssueParamChanged != null)
                 On_CalibrationImageQualityIssueParamChanged(sender, e);
             break;
         case EventNotifyType.CalibrationPlateParamChanged:
             if (On_CalibrationPlateParamChanged != null)
                 On_CalibrationPlateParamChanged(sender, e);
             break;
         case EventNotifyType.CameraParamChanged:
             if (On_CameraParamChanged != null)
                 On_CameraParamChanged(sender, e);
             break;
         case EventNotifyType.ImageAdded:
             if (On_ImageAdded != null)
                 On_ImageAdded(sender, e);
             break;
         case EventNotifyType.ImageRemoved:
             if (On_ImageRemoved != null)
                 On_ImageRemoved(sender, e);
             break;
         case EventNotifyType.ImageSaved:
             if (On_ImageSaved != null)
                 On_ImageSaved(sender, e);
             break;
     }
 }
        /// <summary>
        /// 設定影像品質檢測條件
        /// </summary>
        /// <param name="type"></param>
        /// <param name="value"></param>
        public void SetCalibImageQualityParam(CalibrateType type, object value)
        {
            //ToDo
            var model = true;
            var eventArgs = new CalibrationEventArgs(model) { EventType = EventNotifyType.CalibrationImageQualityIssueParamChanged };
            var sender = this;

            eventNotify(sender, eventArgs);
        }
        public void SetCameraParam(CalibrateSettingType type, object value)
        {
            //ToDo
            var model = true;
            var eventArgs = new CalibrationEventArgs(model) { EventType = EventNotifyType.CameraParamChanged };
            var sender = this;

            eventNotify(sender, eventArgs);
        }
        /// <summary>
        /// 儲存校正影像 - online image acquisition only
        /// </summary>
        public void SaveCalibImage(string imageID)
        {
            //ToDo
            var model = true;
            var eventArgs = new CalibrationEventArgs(model) { EventType = EventNotifyType.ImageSaved };
            var sender = this;

            eventNotify(sender, eventArgs);
        }
        public void SaveCalibratedCameraPose(string filepath)
        {
            //ToDo
            var model = true;
            var eventArgs = new CalibrationEventArgs(model) { EventType = EventNotifyType.CalibratedFileSave };
            var sender = this;

            eventNotify(sender, eventArgs);
        }
 /// <summary>
 /// 移除所有校正影像
 /// </summary>
 public void RemoveAllCalibImages()
 {
     var eventArgs = new CalibrationEventArgs(null) { EventType = EventNotifyType.ImageRemoved, };
     var sender = this;
     try
     {
         _calibImages.Clear();
     }
     catch (Exception ex)
     {
         eventArgs.EventType = EventNotifyType.Error;
         eventArgs.ResetModel(ex.Message);
     }
     finally
     {
         eventNotify(sender, eventArgs);
     }
 }
        /// <summary>
        /// 移除校正影像
        /// </summary>
        public void RemoveCalibImage(string imageID)
        {
            var model = new CalibImageViewModel()
            {
                CalibImageID = imageID,
            };
            var eventArgs = new CalibrationEventArgs(model) { EventType = EventNotifyType.ImageRemoved, };
            var sender = this;

            try
            {
                var calibImage = _calibImages.SingleOrDefault(p => p.ID == imageID);
                if (calibImage != null)
                {
                    _calibImages.Remove(calibImage);
                }
            }
            catch (Exception ex)
            {
                eventArgs.EventType = EventNotifyType.Error;
                eventArgs.ResetModel(ex.Message);
            }
            finally
            {
                eventNotify(sender, eventArgs);
            }
        }
 void _bg_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     var model = e.UserState as ReportModel;
     if (ResponseCalibrationReport != null && model != null)
     {
         CalibrationAssistant.EventNotifyType notifyType;
         if (Enum.TryParse<CalibrationAssistant.EventNotifyType>(model.UserState, out notifyType))
         {
             var args = new CalibrationEventArgs(model)
             {
                 EventType = notifyType,
             };
             ResponseCalibrationReport(sender, args);
         }
     }
 }
        /// <summary>
        /// 校正
        /// </summary>
        public void Calibrate()
        {
            //ToDo
            var model = new CalibratedViewModel();
            var eventArgs = new CalibrationEventArgs(model) { EventType = EventNotifyType.CalibrationCompletd };
            var sender = this;

            eventNotify(sender, eventArgs);
        }
예제 #11
0
 private void assistant_On_ImageSaved(object sender, CalibrationEventArgs e)
 {
     if (e.Model is bool)
     {
         var msg = String.Format("Image saved  - {0}!", (bool)e.Model ? "successed" : "failed");
         setCalibrateStatus(msg);
     }
 }
예제 #12
0
        private void assistant_On_ImageAdded(object sender, CalibrationEventArgs e)
        {
            if (e.Model is CalibImageViewModel)
            {
                CalibImageViewModel vm = (CalibImageViewModel)e.Model;
            #if DEBUG
                if (String.IsNullOrEmpty(vm.CalibImageID))
                    vm.CalibImageID = Guid.NewGuid().ToString();
            #endif

                var calibrationGridViewDataSource = (BindingSource)Calibration_Calibration_GridView.DataSource;
                calibrationGridViewDataSource.Add(vm);

                initCalibrationGrideViewOperatorUI();
                Calibration_QualityIssue_GridView.DataSource = new BindingSource(vm.QualityIssues, null);
                setCalibrateStatus("Image added!", false);
            }
        }
예제 #13
0
 private void assistant_On_CameraParamChanged(object sender, CalibrationEventArgs e)
 {
     if (e.Model is bool)
     {
         var msg = String.Format("Camera param changed - {0}!", (bool)e.Model ? "successed" : "failed");
         setCalibrateStatus(msg);
     }
 }
예제 #14
0
        private void assistant_On_CalibrationImageQualityIssueChanged(object sender, CalibrationEventArgs e)
        {
            if (e.Model is CalibImageViewModel)
            {
                CalibImageViewModel vm = (CalibImageViewModel)e.Model;
            #if DEBUG
                if (String.IsNullOrEmpty(vm.CalibImageID))
                    vm.CalibImageID = Guid.NewGuid().ToString();
            #endif

                Calibration_QualityIssue_GridView.DataSource = new BindingSource(vm.QualityIssues, null);
            }
            setCalibrateStatus("Calibration Image Quality Issue Changed!", false);
        }
예제 #15
0
 private void assistant_On_CalibrationCompleted(object sender, CalibrationEventArgs e)
 {
     if (e.Model is CalibratedViewModel)
     {
         updateCalibratedViewModelToView((CalibratedViewModel)e.Model);
     }
 }