public override bool Apply(bool disposeController)
        {
            var resList = new List <int>(Boxed <int> .ToUnboxedItems(_positions));

            if (MakeColumnStartListCompliant(resList))
            {
                _positions.Clear();
                Boxed <int> .AddRange(_positions, resList);

                Current.Gui.InfoMessageBox("Start positions were adjusted. Please check the result.");
                return(false);
            }
            _doc.StartPositions = resList.ToArray();

            return(ApplyEnd(true, disposeController));
        }
Exemplo n.º 2
0
        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);
        }