Exemple #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();
        }
        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;
        }