Beispiel #1
0
        public override bool Apply(bool disposeController)
        {
            var result = _subController.Apply(disposeController);

            if (result == false)
            {
                return(result);
            }

            return(ApplyEnd(true, disposeController));
        }
Beispiel #2
0
        public override bool Apply(bool disposeController)
        {
            if (!_locationController.Apply(disposeController))
            {
                return(false);
            }

            if (!object.ReferenceEquals(_doc.Location, _locationController.ModelObject))
            {
                _doc.Location.CopyFrom((ItemLocationDirect)_locationController.ModelObject);
            }

            return(ApplyEnd(true, disposeController));
        }
        public override bool Apply(bool disposeController)
        {
            bool result;

            result = _dataSourceOptionsController.Apply(disposeController);
            if (!result)
            {
                return(result);
            }

            result = _processOptionsController.Apply(disposeController);
            if (!result)
            {
                return(result);
            }

            if (null != _processDataController)
            {
                result = _processDataController.Apply(disposeController);
                if (!result)
                {
                    return(result);
                }
            }

            SuccessfullyApplied?.Invoke();
            return(ApplyEnd(true, disposeController));
        }
        private void ReadAnalysisOptionsAndAnalyze()
        {
            if (!_asciiDocumentAnalysisOptionsController.Apply(false))
            {
                return;
            }

            _analysisOptions = (AsciiDocumentAnalysisOptions)_asciiDocumentAnalysisOptionsController.ModelObject;

            if (_asciiStreamData != null)
            {
                _asciiStreamData.Seek(0, System.IO.SeekOrigin.Begin);
                _doc = AsciiDocumentAnalysis.Analyze(_doc, _asciiStreamData, _analysisOptions);
                _asciiStreamData.Seek(0, System.IO.SeekOrigin.Begin);
                Initialize(true); // getting Gui elements filled with the result of the analysis
            }
            else if (_asciiStreamDataProvider != null)
            {
                using (var str = _asciiStreamDataProvider.GetStreamForAnalysis())
                {
                    if (str != null)
                    {
                        str.Seek(0, System.IO.SeekOrigin.Begin);
                        _doc = AsciiDocumentAnalysis.Analyze(_doc, str, _analysisOptions);
                        Initialize(true); // getting Gui elements filled with the result of the analysis
                    }
                }
            }
        }
Beispiel #5
0
        public override bool Apply(bool disposeController)
        {
            bool result;

            result = _dataSourceOptionsController.Apply(disposeController);
            if (!result)
            {
                return(result);
            }

            result = _fourierTransformationOptionsController.Apply(disposeController);
            if (!result)
            {
                return(result);
            }

            if (null != _inputDataController)
            {
                result = _inputDataController.Apply(disposeController);
                if (!result)
                {
                    return(result);
                }
            }

            var ev = SuccessfullyApplied;

            if (null != ev)
            {
                ev();
            }

            return(ApplyEnd(true, disposeController));
        }
Beispiel #6
0
        public override bool Apply(bool disposeController)
        {
            _doc.Font               = _view.LabelFont;
            _doc.Brush              = _view.LabelMaterial;
            _doc.AlignmentX         = (Alignment)_alignmentChoicesX.FirstSelectedNode.Tag;
            _doc.AlignmentY         = (Alignment)_alignmentChoicesY.FirstSelectedNode.Tag;
            _doc.AlignmentZ         = (Alignment)_alignmentChoicesZ.FirstSelectedNode.Tag;
            _doc.AutomaticAlignment = _view.AutomaticAlignment;
            _doc.RotationX          = _view.RotationX;
            _doc.RotationY          = _view.RotationY;
            _doc.RotationZ          = _view.RotationZ;
            _doc.OffsetX            = _view.OffsetX;
            _doc.OffsetY            = _view.OffsetY;
            _doc.OffsetZ            = _view.OffsetZ;
            _doc.BackgroundStyle    = _view.Background;

            if (GUIConversion.TryParseMultipleAltaxoVariant(_view.SuppressedLabelsByValue, out var varVals))
            {
                _doc.SuppressedLabels.ByValues.Clear();
                foreach (AltaxoVariant v in varVals)
                {
                    _doc.SuppressedLabels.ByValues.Add(v);
                }
            }
            else
            {
                return(false);
            }

            if (GUIConversion.TryParseMultipleInt32(_view.SuppressedLabelsByNumber, out var intVals))
            {
                _doc.SuppressedLabels.ByNumbers.Clear();
                foreach (int v in intVals)
                {
                    _doc.SuppressedLabels.ByNumbers.Add(v);
                }
            }
            else
            {
                return(false);
            }

            _doc.PrefixText = _view.PrefixText;
            _doc.SuffixText = _view.PostfixText;

            var labelSideNode = _labelSides.FirstSelectedNode;

            if (null != labelSideNode)
            {
                _doc.LabelSide = (CSAxisSide?)labelSideNode.Tag;
            }

            if (null != _labelFormattingSpecificController && !_labelFormattingSpecificController.Apply(disposeController))
            {
                return(false);
            }

            return(ApplyEnd(true, disposeController));
        }
Beispiel #7
0
        public override bool Apply(bool disposeController)
        {
            _doc.Font  = _view.LabelFont;
            _doc.Brush = _view.LabelBrush.Clone();
            _doc.HorizontalAlignment = (StringAlignment)_horizontalAlignmentChoices.FirstSelectedNode.Tag;
            _doc.VerticalAlignment   = (StringAlignment)_verticalAlignmentChoices.FirstSelectedNode.Tag;
            _doc.AutomaticAlignment  = _view.AutomaticAlignment;
            _doc.Rotation            = _view.Rotation;
            _doc.XOffset             = _view.XOffset;
            _doc.YOffset             = _view.YOffset;
            _doc.BackgroundStyle     = _view.Background;

            if (GUIConversion.TryParseMultipleAltaxoVariant(_view.SuppressedLabelsByValue, out var varVals))
            {
                _doc.SuppressedLabels.ByValues.Clear();
                foreach (AltaxoVariant v in varVals)
                {
                    _doc.SuppressedLabels.ByValues.Add(v);
                }
            }
            else
            {
                return(false);
            }

            if (GUIConversion.TryParseMultipleInt32(_view.SuppressedLabelsByNumber, out var intVals))
            {
                _doc.SuppressedLabels.ByNumbers.Clear();
                foreach (int v in intVals)
                {
                    _doc.SuppressedLabels.ByNumbers.Add(v);
                }
            }
            else
            {
                return(false);
            }

            _doc.PrefixText = _view.PrefixText;
            _doc.SuffixText = _view.PostfixText;

            var labelSideNode = _labelSides.FirstSelectedNode;

            if (null != labelSideNode)
            {
                _doc.LabelSide = (CSAxisSide?)labelSideNode.Tag;
            }

            if (null != _labelFormattingSpecificController && !_labelFormattingSpecificController.Apply(disposeController))
            {
                return(false);
            }

            return(ApplyEnd(true, disposeController));
        }
        public override bool Apply()
        {
            bool result = true;

            if (_styleController != null)
            {
                result &= _styleController.Apply();
            }

            return(result);
        }
 public bool Apply(bool disposeController)
 {
     if (null != _controller)
     {
         return(_controller.Apply(disposeController));
     }
     else
     {
         return(true);
     }
 }
 public bool Apply(bool disposeController)
 {
     if (null != _controllerForEnabledState)
     {
         return(_controllerForEnabledState.Apply(disposeController));
     }
     else
     {
         return(true);
     }
 }
        public override bool Apply(bool disposeController)
        {
            bool result;

            result = _dataProxyController.Apply(disposeController);
            if (!result)
            {
                return(result);
            }

            return(ApplyEnd(result, disposeController));
        }
Beispiel #12
0
        // have this here as controller too
        public override bool Apply(bool disposeController)
        {
            if (_applySuspend++ > 0)
            {
                _applySuspend--;
                return(true);
            }

            bool applyResult = false;

            if (null != _dataController && !_dataController.Apply(disposeController))
            {
                return(false);
            }

            if (!_styleCollectionController.Apply(disposeController))
            {
                return(false);
            }

            var activeSubStyleIndex = GetActiveSubStyleControlIndex();

            if (activeSubStyleIndex.HasValue)
            {
                if (false == _styleControllerList[activeSubStyleIndex.Value].Apply(false))
                {
                    _view.BringTabToFront(activeSubStyleIndex.Value);
                    applyResult = false;
                    goto end_of_function;
                }
                DistributeStyleChange(activeSubStyleIndex.Value, true);
            }

            for (int i = 0; i < _styleControllerList.Count; ++i)
            {
                if (false == _styleControllerList[i].Apply(disposeController))
                {
                    _view.BringTabToFront(i);
                    applyResult = false;
                    goto end_of_function;
                }
            }

            ApplyPlotGroupView(disposeController);

            applyResult = true;

end_of_function:
            _applySuspend--;

            return(ApplyEnd(applyResult, disposeController));
        }
Beispiel #13
0
        public override bool Apply(bool disposeController)
        {
            if (!_dataController.Apply(disposeController))
            {
                return(false);
            }
            if (!_optionsController.Apply(disposeController))
            {
                return(false);
            }

            return(ApplyEnd(true, disposeController));
        }
Beispiel #14
0
        protected override void EhView_ActiveChildControlChanged(object sender, Main.InstanceChangedEventArgs <object> e)
        {
            // first: test if this is the view of the additional style
            if (_additionalPlotStyleController != null && object.ReferenceEquals(_additionalPlotStyleController.ViewObject, e.OldInstance))
            {
                if (!_additionalPlotStyleController.Apply())
                {
                    return;
                }

                if (_additionalPlotStyle is LinePlotStyle && ((LinePlotStyle)_additionalPlotStyle).IsVisible)
                {
                    MakeAdditionalPlotStylePermanent();
                }
                else if (_additionalPlotStyle is ScatterPlotStyle && ((ScatterPlotStyle)_additionalPlotStyle).IsVisible)
                {
                    MakeAdditionalPlotStylePermanent();
                }
            }
            else
            {
                // test if it is the view of the normal styles
                for (int i = 0; i < _styleControllerList.Count; i++)
                {
                    if (_styleControllerList[i] != null && object.ReferenceEquals(_styleControllerList[i].ViewObject, e.OldInstance))
                    {
                        if (!_styleControllerList[i].Apply())
                        {
                            return;
                        }

                        DistributeStyleChange(i);
                    }
                }
            }
        }
Beispiel #15
0
        public override bool Apply(bool disposeController)
        {
            if (!_scaleController.Apply(disposeController))
            {
                return(false);
            }

            if (!_colorProviderController.Apply(disposeController))
            {
                return(false);
            }

            _doc.ClipToLayer   = _view.ClipToLayer;
            _doc.Scale         = (NumericalScale)_scaleController.ModelObject;
            _doc.ColorProvider = (IColorProvider)_colorProviderController.ModelObject;

            return(ApplyEnd(true, disposeController));
        }
        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));
        }
    public override bool Apply(bool disposeController)
    {
      if (!_scaleController.Apply(disposeController))
        return false;

      if (!_colorProviderController.Apply(disposeController))
        return false;

      if (!_materialController.Apply(disposeController))
        return false;
      else
        _doc.Material = (IMaterial)_materialController.ModelObject;

      _doc.ClipToLayer = _view.ClipToLayer;
      _doc.ColorScale = _view.IsCustomColorScaleUsed ? (NumericalScale)_scaleController.ModelObject : null;
      _doc.ColorProvider = (IColorProvider)_colorProviderController.ModelObject;

      return ApplyEnd(true, disposeController);
    }
Beispiel #18
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));
        }
Beispiel #19
0
        public override bool Apply(bool disposeController)
        {
            bool result = true;

            if (_styleController != null)
            {
                if (!_styleController.Apply(disposeController))
                {
                    return(false);
                }
            }

            if (_dataController != null)
            {
                if (!_dataController.Apply(disposeController))
                {
                    return(false);
                }
            }

            return(ApplyEnd(result, disposeController));
        }
Beispiel #20
0
        public override bool Apply(bool disposeController)
        {
            try
            {
                if (!_locationController.Apply(disposeController))
                {
                    return(false);
                }

                if (!object.ReferenceEquals(_doc.Location, _locationController.ModelObject))
                {
                    _doc.Location.CopyFrom((ItemLocationDirect)_locationController.ModelObject);
                }

                _doc.Pen = _view.DocPen;
            }
            catch (Exception ex)
            {
                Current.Gui.ErrorMessageBox(string.Format("An exception has occured during applying of your settings. The message is: {0}", ex.Message));
                return(false);
            }

            return(ApplyEnd(true, disposeController));
        }
Beispiel #21
0
        public override bool Apply(bool disposeController)
        {
            _doc.CreationOptions.IgnoreNaN      = _view.IgnoreNaNValues;
            _doc.CreationOptions.IgnoreInfinity = _view.IgnoreInfiniteValues;

            if (_view.IgnoreValuesBelowLowerBoundary)
            {
                _doc.CreationOptions.IsLowerBoundaryInclusive = _view.IsLowerBoundaryInclusive;
                _doc.CreationOptions.LowerBoundaryToIgnore    = _view.LowerBoundary;
            }
            else
            {
                _doc.CreationOptions.IsLowerBoundaryInclusive = true;
                _doc.CreationOptions.LowerBoundaryToIgnore    = null;
            }

            if (_view.IgnoreValuesAboveUpperBoundary)
            {
                _doc.CreationOptions.IsUpperBoundaryInclusive = _view.IsUpperBoundaryInclusive;
                _doc.CreationOptions.UpperBoundaryToIgnore    = _view.UpperBoundary;
            }
            else
            {
                _doc.CreationOptions.IsUpperBoundaryInclusive = true;
                _doc.CreationOptions.UpperBoundaryToIgnore    = null;
            }

            _doc.CreationOptions.IsUserDefinedBinningType = !_view.UseAutomaticBinning;

            if (!_binningController.Apply(disposeController))
            {
                return(ApplyEnd(false, disposeController));
            }

            bool shouldShowDialog = HistogramCreation.PopulateHistogramCreationInformation(_doc);

            if (disposeController) // user pressed ok
            {
                if (ShouldLeaveDialogOpen(_doc))
                {
                    Initialize(true);
                    return(ApplyEnd(false, disposeController));
                }
                else
                {
                    return(ApplyEnd(true, disposeController));
                }
            }
            else
            {
                // we pressed apply thus we must update the gui
                if (ShouldLeaveDialogOpen(_doc))
                {
                    Initialize(true);
                    return(ApplyEnd(false, disposeController));
                }
                else
                {
                    Initialize(true);
                    return(ApplyEnd(true, disposeController));
                }
            }
        }
        private bool ApplyWithoutClosing()
        {
            if (null != _separationStrategyInstanceController)
            {
                if (_separationStrategyInstanceController.Apply(false))
                {
                    _doc.SeparationStrategy = (IAsciiSeparationStrategy)_separationStrategyInstanceController.ModelObject;
                }
                else
                {
                    return(false);
                }
            }

            _doc.NumberOfMainHeaderLines = _view.NumberOfMainHeaderLines;
            _doc.IndexOfCaptionLine      = _view.IndexOfCaptionLine;

            _doc.RenameColumns   = _view.RenameColumnsWithHeaderNames;
            _doc.RenameWorksheet = _view.RenameWorksheetWithFileName;
            _doc.ImportMultipleStreamsVertically = _view.ImportMultipleAsciiVertically;

            if (_view.NumberFormatCultureIsKnowm)
            {
                _doc.NumberFormatCulture = (CultureInfo)_numberFormatList.FirstSelectedNode.Tag;
            }
            else
            {
                _doc.NumberFormatCulture = null;
            }

            if (_view.DateTimeFormatCultureIsKnown)
            {
                _doc.DateTimeFormatCulture = (CultureInfo)_dateTimeFormatList.FirstSelectedNode.Tag;
            }
            else
            {
                _doc.DateTimeFormatCulture = null;
            }

            if (_view.GuiSeparationStrategyIsKnown)
            {
                // this case was already handled above
            }
            else
            {
                _doc.SeparationStrategy = null;
            }

            if (_view.TableStructureIsKnown)
            {
                _doc.RecognizedStructure.Clear();
                Boxed <AsciiColumnType> .AddRange(_doc.RecognizedStructure.ColumnTypes, _tableStructure);

                if (_doc.RecognizedStructure.Count == 0)
                {
                    _doc.RecognizedStructure = null;
                }
            }
            else
            {
                _doc.RecognizedStructure = null;
            }

            _doc.HeaderLinesDestination = (AsciiHeaderLinesDestination)_headerLinesDestination.FirstSelectedNode.Tag;

            return(true);
        }