Exemple #1
0
        protected BottomSheet()
        {
            IsVisible = false;

            _bottomSheetContainer = new SheetContainer
            {
                VerticalOptions = LayoutOptions.Fill
            };

            BottomSheetMaxY = Constants.height * HeightRatio;

            _bottomSheetContainer.BottomSheetPulledDown += OnBottomSheetDisappearred;
            _bottomSheetContainer.MaxY = BottomSheetMaxY;
            _bottomSheetContainer.SheetFrame.TranslationY = BottomSheetMaxY;

            var backgroundGesture = new TapGestureRecognizer();

            backgroundGesture.Tapped += OnBottomSheetDisappearred;

            _bottomSheetBackground = new BoxView
            {
                HorizontalOptions  = LayoutOptions.Fill,
                VerticalOptions    = LayoutOptions.Fill,
                Opacity            = 0,
                BackgroundColor    = Color.FromRgba(0, 0, 0, 0.5),
                GestureRecognizers = { backgroundGesture }
            };
            //_bottomSheetBackground.SetAppThemeColor(BackgroundColorProperty, Color.FromRgba(0, 0, 0, 0.5), Color.FromRgba(255, 255, 255, 0.5));

            Children.Add(_bottomSheetBackground);
            Children.Add(_bottomSheetContainer);
        }
        public async Task <ISheet> LoadSheet(string fileUrl, int sheetIndex, string[] map = null)
        {
            url = fileUrl;
            specificSheetIndex = sheetIndex;
            tempLocalFilePath  = await CopyFileLocal(fileUrl);

            await using var tempStream = File.Open(tempLocalFilePath, FileMode.Open, FileAccess.Read);

            using var tmpReader = ExcelReaderFactory.CreateReader(tempStream);

            if (tmpReader.ResultsCount == 0)
            {
                return(null);
            }

            if (tmpReader.ResultsCount - 1 < specificSheetIndex)
            {
                return(null);
            }

            var sheets = new ISheet[tmpReader.ResultsCount];

            var container = new SheetContainer(fileUrl, sheets);

            for (var i = 0; i < tmpReader.ResultsCount; i++)
            {
                if (i == specificSheetIndex)
                {
                    var ignoreHeader = map != null;
                    tmpReader.Read();
                    CurrentSheet = new Sheet(tmpReader, container, i, ignoreHeader);
                }
                else
                {
                    tmpReader.NextResult();
                }
            }

            return(CurrentSheet);
        }
        public async Task <ISheetContainer> Load(string fileUrl, ICollection <SheetMappingOptions> sheetsOptions)
        {
            url = fileUrl;

            tempLocalFilePath = await CopyFileLocal(fileUrl);

            await using var tempStream = File.Open(tempLocalFilePath, FileMode.Open, FileAccess.Read);

            using var tmpReader = ExcelReaderFactory.CreateReader(tempStream);


            if (tmpReader.ResultsCount == 0)
            {
                return(null);
            }

            var sheets = new ISheet[tmpReader.ResultsCount];

            var result = new SheetContainer(fileUrl, sheets);

            for (var i = 0; i < sheets.Length; i++)
            {
                var ignoreHeader = true;
                var options      = sheetsOptions?.FirstOrDefault(o => o.SheetIndex == i) ?? SheetMappingOptions.Default(i);
                if (options.Map != null)
                {
                    ignoreHeader = false;
                }
                tmpReader.Read();
                var sheet = new Sheet(tmpReader, result, i, ignoreHeader);
                result.Sheets[i] = sheet;
                tmpReader.NextResult();
            }
            Container    = result;
            CurrentSheet = Container.Sheets[0];

            return(result);
        }
 public SheetContext(ISheet sheet, SheetContainer worksheetContainer)
 {
     _sheet             = sheet;
     WorksheetContainer = worksheetContainer;
 }
Exemple #5
0
        public MasterSheet(SheetContainer Container, int sheetNo)
            : base(Container, sheetNo)
        {

        }
Exemple #6
0
 public Sheet(SheetContainer Container, int sheetNo) {
     _Container = Container;
     _sheetNo = sheetNo;
 }
Exemple #7
0
 public MasterSheet(SheetContainer Container, int sheetNo)
     : base(Container, sheetNo)
 {
 }