Ejemplo n.º 1
0
        public override void LoadView()
        {
            View = new UIView();

            _pageViewController = new MultiStepProcessHorizontal(new MultiStepProcessDataSource(Steps));
            _pageViewController.WillTransition += _multiStepProcessHorizontal_WillTransition;

            _pageControl = new HorizontalSwipePageControl
            {
                CurrentPage = 0,
                Pages       = Steps.Count - 1
            };
            _skipButton = new UIButton();
            _skipButton.SetTitle("Skip", UIControlState.Normal);
            _skipButton.SetTitleColor(IOSTheme.JGLightPink, UIControlState.Normal);
            _skipButton.Font = IOSTheme.ThemeFontRegular(14);

            _skipButton.TouchUpInside += SkipTapped;


            _getStartedButton = new UIButton();
            _getStartedButton.SetTitle("Get started", UIControlState.Normal);
            _getStartedButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            _getStartedButton.Font = IOSTheme.ThemeFontBold(16);
            _getStartedButton.Layer.BorderWidth  = 1;
            _getStartedButton.Layer.BorderColor  = UIColor.White.CGColor;
            _getStartedButton.Layer.CornerRadius = 2;
            _getStartedButton.AccessibilityLabel = "GetStartedButton";


            _getStartedButton.TouchUpInside += GetStartedTapped;

            _pageControl.CurrentPage = 0;

            View.Add(_pageViewController.View);
            View.Add(_pageControl);
            View.Add(_skipButton);
            View.Add(_getStartedButton);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            View.AddConstraints(
                _pageViewController.View.AtTopOf(View),
                _pageViewController.View.AtBottomOf(View),
                _pageViewController.View.AtLeftOf(View),
                _pageViewController.View.AtRightOf(View),

                _pageControl.WithSameCenterX(_pageViewController.View),
                _pageControl.AtBottomOf(View, 20),

                _skipButton.AtRightOf(View, 18),
                _skipButton.WithSameCenterY(_pageControl),

                _getStartedButton.Height().EqualTo(44),
                _getStartedButton.WithSameCenterX(View),
                _getStartedButton.AtLeftOf(View, 22),
                _getStartedButton.AtRightOf(View, 22),
                _getStartedButton.AtBottomOf(View, 22)
                );

            View.BringSubviewToFront(_getStartedButton);
        }
        public override void LoadView()
        {
            View = new UIView();
            View.BackgroundColor = UIColor.White;

            _pageTitles = new List <string> {
                "Write your question", "Review your post", "Who should see this?"
            };
            _pageTitle           = new UILabel();
            _pageTitle.TextColor = UIColor.FromRGB(255, 200, 0);
            _pageTitle.Font      = UIFont.BoldSystemFontOfSize(12);

            _pageViewController = new MultiStepProcessHorizontal(new MultiStepProcessDataSource(Steps));
            _pageViewController.WillTransition += _multiStepProcessHorizontal_WillTransition;

            _pageControl = new HorizontalSwipePageControl
            {
                CurrentPage       = 0,
                Pages             = Steps.Count,
                BackgroundColor   = UIColor.White,
                BorderColorBottom = UIColor.LightGray,
                BorderWidthAll    = 0.5f
            };

            _pageControl.CurrentPage = 0;

            _nextButton = new PageControlUIButton
            {
                BorderColorBottom = UIColor.LightGray,
                BorderWidthAll    = 0.5f
            };
            _nextButton.SetTitle("    Next  >  ", UIControlState.Normal);
            _nextButton.Font  = UIFont.SystemFontOfSize(16);
            _nextButton.Frame = new CoreGraphics.CGRect(0, 0, 75, 50);

            if (ScreenState == PortableLibrary.Enums.ScreenState.Edit.ToString())
            {
                _nextButton.SetTitleColor(UIColor.White, UIControlState.Normal);
                _nextButton.BackgroundColor = UIColor.FromRGB(70, 230, 130);
            }
            else
            {
                _nextButton.SetTitleColor(UIColor.FromRGB(220, 220, 220), UIControlState.Normal);
                _nextButton.BackgroundColor = UIColor.White;
            }

            _nextButton.TouchUpInside += NextTapped;

            _backButton = new PageControlUIButton
            {
                BorderColorBottom = UIColor.LightGray,
                BorderWidthAll    = 0.5f
            };
            _backButton.SetTitle("  <  Back  ", UIControlState.Normal);
            _backButton.SetTitleColor(UIColor.FromRGB(90, 89, 89), UIControlState.Normal);
            _backButton.Font            = UIFont.SystemFontOfSize(16);
            _backButton.Frame           = new CoreGraphics.CGRect(0, 0, 75, 50);
            _backButton.BackgroundColor = UIColor.White;

            _backButton.TouchUpInside += BackTapped;

            _askButton = new PageControlUIButton
            {
                BorderColorBottom = UIColor.LightGray,
                BorderWidthAll    = 0.5f
            };
            _askButton.SetTitle("  Publish  >  ", UIControlState.Normal);
            _askButton.SetTitleColor(UIColor.LightGray, UIControlState.Normal);
            _askButton.Font            = UIFont.SystemFontOfSize(14);
            _askButton.Frame           = new CoreGraphics.CGRect(0, 0, 75, 50);
            _askButton.BackgroundColor = UIColor.White;
            _askButton.Hidden          = true;

            _askButton.TouchUpInside += AskTapped;

            View.Add(_pageViewController.View);
            View.Add(_pageControl);
            View.Add(_nextButton);
            View.Add(_askButton);
            View.Add(_backButton);
            View.Add(_pageTitle);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            View.AddConstraints(
                _pageViewController.View.AtTopOf(View),
                _pageViewController.View.AtBottomOf(View),
                _pageViewController.View.AtLeftOf(View),
                _pageViewController.View.AtRightOf(View),

                _pageControl.WithSameCenterX(_pageViewController.View),
                _pageControl.AtLeftOf(View),
                _pageControl.AtRightOf(View),
                _pageControl.ToTopMargin(View),
                _pageControl.Height().EqualTo(50),

                _nextButton.AtRightOf(View),
                _nextButton.AtTopOf(_pageControl),
                _nextButton.WithSameCenterY(_pageControl),

                _backButton.AtLeftOf(View),
                _backButton.AtTopOf(_pageControl),
                _backButton.WithSameCenterY(_pageControl),

                _askButton.AtRightOf(View),
                _askButton.AtTopOf(_pageControl),
                _askButton.WithSameCenterY(_pageControl),

                _pageTitle.WithSameCenterX(_pageControl),
                _pageTitle.AtTopOf(_pageControl, 30)
                );
        }