Esempio n. 1
0
        protected override void Initialize(bool initData)
        {
            base.Initialize(initData);

            if (initData)
            {
                _binningTypes.Clear();

                var binningTypes = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(IBinning));

                foreach (var type in binningTypes)
                {
                    _binningTypes.Add(new SelectableListNode(type.ToString(), type, type == _doc.CreationOptions.Binning.GetType()));
                }

                if (null != _binningController)
                {
                    _binningController.Dispose();
                    _binningController = null;
                }

                _binningController = (IMVCANController)Current.Gui.GetControllerAndControl(new object[] { _doc.CreationOptions.Binning }, typeof(IMVCANController), UseDocument.Directly);
            }
            if (null != _view)
            {
                _view.Errors   = _doc.Errors;
                _view.Warnings = _doc.Warnings;

                _view.NumberOfValuesOriginal = _doc.NumberOfValuesOriginal;
                _view.NumberOfValuesFiltered = _doc.NumberOfValuesFiltered;
                _view.NumberOfNaNValues      = _doc.NumberOfNaNValues;
                _view.NumberOfInfiniteValues = _doc.NumberOfInfiniteValues;
                _view.MinimumValue           = _doc.MinimumValue;
                _view.MaximumValue           = _doc.MaximumValue;

                _view.IgnoreNaNValues      = _doc.CreationOptions.IgnoreNaN;
                _view.IgnoreInfiniteValues = _doc.CreationOptions.IgnoreInfinity;

                _view.IgnoreValuesBelowLowerBoundary = _doc.CreationOptions.LowerBoundaryToIgnore.HasValue;
                _view.IsLowerBoundaryInclusive       = _doc.CreationOptions.IsLowerBoundaryInclusive;
                if (_doc.CreationOptions.LowerBoundaryToIgnore.HasValue)
                {
                    _view.LowerBoundary = _doc.CreationOptions.LowerBoundaryToIgnore.Value;
                }

                _view.IgnoreValuesAboveUpperBoundary = _doc.CreationOptions.UpperBoundaryToIgnore.HasValue;
                _view.IsUpperBoundaryInclusive       = _doc.CreationOptions.IsUpperBoundaryInclusive;
                if (_doc.CreationOptions.UpperBoundaryToIgnore.HasValue)
                {
                    _view.UpperBoundary = _doc.CreationOptions.UpperBoundaryToIgnore.Value;
                }

                _view.BinningType = _binningTypes;

                _view.UseAutomaticBinning = !_doc.CreationOptions.IsUserDefinedBinningType;

                _view.BinningView = _binningController.ViewObject;
            }
        }
        public override bool Apply(bool disposeController)
        {
            bool result;

            result = _commonImportOptionsController.Apply(false);
            if (!result)
            {
                return(result);
            }
            else
            {
                _doc.ImportOptions = (Altaxo.Data.IDataSourceImportOptions)_commonImportOptionsController.ModelObject;
            }

            result = _specificImportOptionsController.Apply(false);
            if (!result)
            {
                Current.Gui.ErrorMessageBox("Error in script. Please edit the script to remove the error");
                return(result);
            }
            else
            {
                _doc.ImportScript = (FileImportScript)_specificImportOptionsController.ModelObject; // AsciiImportOptions is cloned in property set
            }
            result = _specificImportSourceController.Apply(false);
            if (!result)
            {
                return(result);
            }
            else
            {
                _doc.SourceFileNames = (IEnumerable <string>)_specificImportSourceController.ModelObject; // AsciiImportOptions is cloned in property set
            }
            if (disposeController)
            {
                _commonImportOptionsController.Dispose();
                _specificImportOptionsController.Dispose();
                _specificImportSourceController.Dispose();
            }

            SuccessfullyApplied?.Invoke();

            return(ApplyEnd(true, disposeController));
        }
Esempio n. 3
0
        public override bool Apply(bool disposeController)
        {
            bool result;

            result = _commonImportOptionsController.Apply(false);
            if (!result)
            {
                return(result);
            }
            else
            {
                _doc.ImportOptions = (Altaxo.Data.IDataSourceImportOptions)_commonImportOptionsController.ModelObject;
            }

            result = _specificImportOptionsController.Apply(false);
            if (!result)
            {
                return(result);
            }
            else
            {
                _doc.AsciiImportOptions = (AsciiImportOptions)_specificImportOptionsController.ModelObject; // AsciiImportOptions is cloned in property set
            }
            result = _specificImportSourceController.Apply(false);
            if (!result)
            {
                return(result);
            }
            else
            {
                _doc.SourceFileNames = (IEnumerable <string>)_specificImportSourceController.ModelObject; // AsciiImportOptions is cloned in property set
            }
            if (disposeController)
            {
                _commonImportOptionsController.Dispose();
                _specificImportOptionsController.Dispose();
                _specificImportSourceController.Dispose();
            }

            SuccessfullyApplied?.Invoke();
            return(ApplyEnd(true, disposeController));
        }