コード例 #1
0
        public async override Task ReloadAsync()
        {
            var calibratorApp = new CalibratorApplication(_calibrator.Results, _calibrator.Constants);
            var points        = await calibratorApp.CalculateErrorsAsync();

            Error = await AngularCalibrationErrorVM.CreateAsync(points.Flatten().ToArray());
        }
コード例 #2
0
        public override async Task ReloadAsync()
        {
            using (new FlagInverseAction(true, v => IsLoading = v))
            {
                var hasOldState = Error != null;
                var oldAngle    = Error?.Angle;
                var oldVSet     = Error?.SelectedSet?.Value?.Set;

                foreach (var useTestAngle in new bool[] { false, true })
                {
                    var baseMeasures  = _calibrator.Results.ToList();
                    var calibratorApp = new CalibratorApplication(baseMeasures, _calibrator.Constants);
                    var points        = await calibratorApp.CalculateErrorsAsync(useTestAngle);

                    var errors = new ErrorsCollection();
                    var tasks  = points.Length.Range()
                                 .Select(i => TemperatureCalibrationErrorVM.CreateAsync(points[i]))
                                 .ToArray();
                    for (int i = 0; i < points.Length; i++)
                    {
                        errors.Add(await tasks[i]);
                        errors[i].PropertyChanged += TemperatureCalibrationErrorsVM_PropertyChanged1;
                    }

                    _errors[useTestAngle] = errors;
                }

                Update();

                if (hasOldState)
                {
                    Error             = _errors[UseTestPoint].First(e => e.Angle == oldAngle);
                    Error.SelectedSet = Error.VectorsSets.First(s => s.Value.Set == oldVSet);
                }
            }
        }