Ejemplo n.º 1
0
        public Carousel_Tablet()
        {
            //Carousel
            carousel                    = new SFCarousel();
            carousel.ItemHeight         = 350;
            carousel.ItemWidth          = 200;
            carousel.SelectedItemOffset = 20;

            //CarouselItem collection creation
            NSMutableArray <SFCarouselItem> carouselItemCollection = new NSMutableArray <SFCarouselItem>();

            for (int i = 1; i <= 7; i++)
            {
                carouselItem           = new SFCarouselItem();
                carouselItem.ImageName = "image" + i + ".png";
                carouselItemCollection.Add(carouselItem);
            }

            carousel.DataSource    = carouselItemCollection;
            carousel.SelectedIndex = 2;
            carousel.Frame         = new CGRect(125, 190, 350, 650);

            this.AddSubview(carousel);
            variableDeclaration();
            autoHide();
            loadOptionView();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:SampleBrowser.LoadMoreSample"/> class.
        /// </summary>
        public LoadMoreSample()
        {
            carouselScrollview = new UIScrollView();
            alertWindow        = new UIAlertView();
            alertWindow.AddButton("OK");
            carouselViewModel = new CarouselViewModel();

            LoadMoreLayout = new UIView();
            LoadMoreLayout.BackgroundColor     = UIColor.FromRGB(249, 249, 249);
            carouselScrollview.BackgroundColor = UIColor.FromRGB(249, 249, 249);
            applicationLabel           = new UILabel();
            applicationLabel.Text      = "Application";
            applicationLabel.TextColor = UIColor.FromRGBA(nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse("0.9764705882352941"));
            applicationLabel.Font      = UIFont.FromName("Helvetica", 18f);

            applicationCarousel                    = new SFCarousel();
            applicationCarousel.ItemWidth          = 150;
            applicationCarousel.ItemHeight         = 150;
            applicationCarousel.AllowLoadMore      = true;
            applicationCarousel.LoadMoreItemsCount = 4;
            UILabel loadmore2 = new UILabel()
            {
                TextColor = UIColor.Black, Text = "Load More...", Font = UIFont.FromName("Helvetica-Bold", 13f), TextAlignment = UITextAlignment.Center
            };

            loadmore2.Frame = new CoreGraphics.CGRect(12, 61, 150, 17);
            UIView loadView2 = new UIView();

            loadView2.BackgroundColor = UIColor.FromRGB(255, 255, 255);
            loadView2.AddSubview(loadmore2);
            applicationCarousel.LoadMoreView = loadView2;
            applicationCarousel.ViewMode     = SFCarouselViewMode.SFCarouselViewModeLinear;
            applicationCarousel.ItemsSource  = carouselViewModel.ApplicationCollection;
            applicationCarousel.ItemSpacing  = 15;
            applicationCarousel.DrawView    += DrawAdapterView;

            foodLabel           = new UILabel();
            foodLabel.Text      = "Food";
            foodLabel.TextColor = UIColor.FromRGBA(nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse("0.9764705882352941"));
            foodLabel.Font      = UIFont.FromName("Helvetica", 18f);

            foodCarousel                    = new SFCarousel();
            foodCarousel.ItemWidth          = 150;
            foodCarousel.ItemHeight         = 150;
            foodCarousel.AllowLoadMore      = true;
            foodCarousel.LoadMoreItemsCount = 4;
            UILabel loadmore = new UILabel()
            {
                TextColor = UIColor.Black, Text = "Load More...", Font = UIFont.FromName("Helvetica-Bold", 13f), TextAlignment = UITextAlignment.Center
            };
            UIView loadView = new UIView();

            loadmore.Frame           = new CoreGraphics.CGRect(12, 61, 150, 17);
            loadView.BackgroundColor = UIColor.FromRGB(255, 255, 255);
            loadView.AddSubview(loadmore);
            foodCarousel.LoadMoreView = loadView;

            foodCarousel.ItemSpacing = 15;
            foodCarousel.ViewMode    = SFCarouselViewMode.SFCarouselViewModeLinear;
            foodCarousel.ItemsSource = carouselViewModel.TransportCollection;
            foodCarousel.DrawView   += DrawFoodAdapterView;

            LoadMoreLayout.AddSubview(applicationLabel);
            LoadMoreLayout.AddSubview(applicationCarousel);
            LoadMoreLayout.AddSubview(foodLabel);
            LoadMoreLayout.AddSubview(foodCarousel);

            bankingLabel           = new UILabel();
            bankingLabel.Text      = "Banking";
            bankingLabel.TextColor = UIColor.FromRGBA(nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse((51 / 255.0).ToString()), nfloat.Parse("0.9764705882352941"));
            bankingLabel.Font      = UIFont.FromName("Helvetica", 18f);

            bankCarousel                    = new SFCarousel();
            bankCarousel.ItemWidth          = 150;
            bankCarousel.ItemHeight         = 150;
            bankCarousel.AllowLoadMore      = true;
            bankCarousel.LoadMoreItemsCount = 4;
            UILabel loadmore1 = new UILabel()
            {
                TextColor = UIColor.Black, Text = "Load More...", Font = UIFont.FromName("Helvetica-Bold", 13f), TextAlignment = UITextAlignment.Center
            };
            UIView loadView1 = new UIView();

            loadmore1.Frame           = new CoreGraphics.CGRect(12, 61, 150, 17);
            loadView1.BackgroundColor = UIColor.FromRGB(255, 255, 255);
            loadView1.AddSubview(loadmore1);
            bankCarousel.LoadMoreView = loadView1;

            bankCarousel.ItemSpacing = 15;
            bankCarousel.ViewMode    = SFCarouselViewMode.SFCarouselViewModeLinear;
            bankCarousel.ItemsSource = carouselViewModel.OfficeCollection;
            bankCarousel.DrawView   += DrawBankAdapterView;

            LoadMoreLayout.AddSubview(applicationLabel);
            LoadMoreLayout.AddSubview(applicationCarousel);
            LoadMoreLayout.AddSubview(foodLabel);
            LoadMoreLayout.AddSubview(foodCarousel);
            LoadMoreLayout.AddSubview(bankingLabel);
            LoadMoreLayout.AddSubview(bankCarousel);


            carouselScrollview.AddSubview(LoadMoreLayout);
            this.AddSubview(carouselScrollview);
        }
        public Carousel_Mobile()
        {
            viewModePicker = new UIPickerView();
            PickerModel viewModel = new PickerModel(viewModeList);

            viewModePicker.Model = viewModel;
            viewModeLabel        = new UILabel();
            viewButton           = new UIButton();
            this.OptionView      = new UIView();

            NSMutableArray <SFCarouselItem> carouselItemCollection = new NSMutableArray <SFCarouselItem> ();

            carousel = new SFCarousel();
            if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                carousel.Frame = new CGRect(150, 150, 300, 650);
            }
            else
            {
                carousel.Frame = new CGRect(0, 0, 300, 430);
            }
            carousel.ItemHeight         = 300;
            carousel.ItemWidth          = 150;
            carousel.SelectedItemOffset = 20;

            for (int i = 1; i <= 7; i++)
            {
                carouselItem           = new SFCarouselItem();
                carouselItem.ImageName = "image" + i + ".png";
                carouselItemCollection.Add(carouselItem);
            }

            carousel.DataSource    = carouselItemCollection;
            carousel.SelectedIndex = 2;
            this.AddSubview(carousel);

            offsetLabel        = new UILabel();
            scaleOffsetLabel   = new UILabel();
            rotationAngleLabel = new UILabel();

            offsetLabel.Text          = "OFFSET";
            offsetLabel.TextColor     = UIColor.Black;
            offsetLabel.TextAlignment = UITextAlignment.Left;
            offsetLabel.Font          = UIFont.FromName("Helvetica", 14f);

            scaleOffsetLabel.Text          = "SCALE OFFSET";
            scaleOffsetLabel.TextColor     = UIColor.Black;
            scaleOffsetLabel.TextAlignment = UITextAlignment.Left;
            scaleOffsetLabel.Font          = UIFont.FromName("Helvetica", 14f);

            rotationAngleLabel.Text          = "ROTATION ANGLE";
            rotationAngleLabel.TextColor     = UIColor.Black;
            rotationAngleLabel.TextAlignment = UITextAlignment.Left;
            rotationAngleLabel.Font          = UIFont.FromName("Helvetica", 14f);


            offsetTextfield = new UITextView();
            offsetTextfield.TextAlignment     = UITextAlignment.Center;
            offsetTextfield.Layer.BorderColor = UIColor.Black.CGColor;
            offsetTextfield.KeyboardType      = UIKeyboardType.NumberPad;
            offsetTextfield.BackgroundColor   = UIColor.FromRGB(246, 246, 246);
            offsetTextfield.Text     = "60";
            offsetTextfield.Changed += (object sender, EventArgs e) =>
            {
                if (offsetTextfield.Text.Length > 0)
                {
                    carousel.Offset = nfloat.Parse(offsetTextfield.Text);
                }
                else
                {
                    carousel.Offset = 60;
                }
            };

            scaleOffsetTextfield = new UITextView();
            scaleOffsetTextfield.TextAlignment     = UITextAlignment.Center;
            scaleOffsetTextfield.Layer.BorderColor = UIColor.Black.CGColor;
            scaleOffsetTextfield.BackgroundColor   = UIColor.FromRGB(246, 246, 246);
            scaleOffsetTextfield.KeyboardType      = UIKeyboardType.NumberPad;
            scaleOffsetTextfield.Text     = "0.8";
            scaleOffsetTextfield.Changed += (object sender, EventArgs e) =>
            {
                if (scaleOffsetTextfield.Text.Length > 0)
                {
                    carousel.ScaleOffset = nfloat.Parse(scaleOffsetTextfield.Text);
                }
                else
                {
                    carousel.ScaleOffset = (nfloat)0.8;
                }
            };

            rotationAngleTextfield = new UITextView();
            rotationAngleTextfield.TextAlignment     = UITextAlignment.Center;
            rotationAngleTextfield.Layer.BorderColor = UIColor.Black.CGColor;
            rotationAngleTextfield.BackgroundColor   = UIColor.FromRGB(246, 246, 246);
            rotationAngleTextfield.KeyboardType      = UIKeyboardType.NumberPad;
            rotationAngleTextfield.Text     = "45";
            rotationAngleTextfield.Changed += (object sender, EventArgs e) =>
            {
                if (rotationAngleTextfield.Text.Length > 0)
                {
                    carousel.RotationAngle = int.Parse(rotationAngleTextfield.Text);
                }
                else
                {
                    carousel.RotationAngle = 45;
                }
            };
            //viewModeLabel
            viewModeLabel.Text          = "VIEW MODE";
            viewModeLabel.TextColor     = UIColor.Black;
            viewModeLabel.TextAlignment = UITextAlignment.Left;

            //viewButton
            viewButton.SetTitle("Default", UIControlState.Normal);
            viewButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            viewButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Center;
            viewButton.Layer.CornerRadius  = 8;
            viewButton.Layer.BorderWidth   = 2;
            viewButton.TouchUpInside      += ShowviewModePicker;
            viewButton.Layer.BorderColor   = UIColor.FromRGB(246, 246, 246).CGColor;

            //viewDoneButton
            viewDoneButton.SetTitle("Done\t", UIControlState.Normal);
            viewDoneButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            viewDoneButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Right;
            viewDoneButton.TouchUpInside      += HidePicker;
            viewDoneButton.Hidden                 = true;
            viewDoneButton.BackgroundColor        = UIColor.FromRGB(246, 246, 246);
            viewModel.PickerChanged              += viewSelectedIndexChanged;
            viewModePicker.ShowSelectionIndicator = true;
            viewModePicker.Hidden                 = true;
            //viewModePicker.BackgroundColor = UIColor.Gray;
        }