public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "Auto Scroll Test";
            View.BackgroundColor   = UIColor.White;
            EdgesForExtendedLayout = UIRectEdge.None;

            // Create containers
            _contentView = new UIView();
            var scrollView = new UIScrollView {
                _contentView
            };

            Add(scrollView);

            // Create form elements
            const int count = 7;

            for (var i = 1; i <= count; i++)
            {
                _contentView.Add(new UITextField
                {
                    Placeholder   = $"Test {i}",
                    BorderStyle   = UITextBorderStyle.RoundedRect,
                    Tag           = i,
                    ReturnKeyType = i < count ? UIReturnKeyType.Send : UIReturnKeyType.Done
                });
            }

            var loginButton = new UIButton(UIButtonType.System);

            loginButton.SetTitle("Save", UIControlState.Normal);
            loginButton.TouchUpInside += (sender, args) => Save();

            _contentView.Add(loginButton);

            // Auto layout
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            View.AddConstraints(scrollView.FullWidthOf(View));
            View.AddConstraints(scrollView.FullHeightOf(View));
            View.AddConstraints(
                _contentView.WithSameWidth(View),
                _contentView.WithSameHeight(View).SetPriority(UILayoutPriority.DefaultLow)
                );

            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            scrollView.AddConstraints(_contentView.FullWidthOf(scrollView));
            scrollView.AddConstraints(_contentView.FullHeightOf(scrollView));

            var formConstraints = _contentView
                                  .VerticalStackPanelConstraints(new Margins(20), _contentView.Subviews);

            // very important to make scrolling work
            var bottomViewConstraint = _contentView.Subviews.Last().AtBottomOf(_contentView).Minus(20);

            _contentView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            _contentView.AddConstraints(formConstraints);
            _contentView.AddConstraints(bottomViewConstraint);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            EdgesForExtendedLayout = UIRectEdge.None;

            UIScrollView scrollView = new UIScrollView();

            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;
            View.AddSubview(scrollView);

            TextContentLabel       = new UILabel();
            TextContentLabel.Lines = 0;
            TextContentLabel.TranslatesAutoresizingMaskIntoConstraints = false;
            scrollView.AddSubview(TextContentLabel);

            var attr    = new NSAttributedStringDocumentAttributes();
            var nsError = new NSError();

            attr.DocumentType = NSDocumentType.HTML;

            TextContentLabel.AttributedText = new NSAttributedString(TextToView, attr, ref nsError);


            var viewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { scrollView, TextContentLabel }, new NSObject[] { new NSString("scrollView"), new NSString("TextContentLabel") });

            scrollView.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[TextContentLabel(scrollView)]|", 0, null, viewsDictionary));
            scrollView.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[TextContentLabel]|", 0, null, viewsDictionary));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-[scrollView]-|", 0, null, viewsDictionary));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-[scrollView]-|", 0, null, viewsDictionary));
        }
 private void Constraint()
 {
     containerView.AddSubviews(content1, content2, content3);
     containerView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
     containerView.AddConstraints(
         content1.Width().EqualTo(300),
         content1.Height().EqualTo(300),
         content1.AtTopOf(containerView).Plus(20),
         content1.WithSameCenterX(containerView),
         content2.Width().EqualTo(300),
         content2.Height().EqualTo(300),
         content2.Below(content1).Plus(20),
         content2.WithSameCenterX(containerView),
         content3.Width().EqualTo(300),
         content3.Height().EqualTo(300),
         content3.Below(content2).Plus(20),
         content3.WithSameCenterX(containerView)
         );
     scrollView.AddSubviews(containerView);
     scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
     scrollView.AddConstraints(
         containerView.WithSameHeight(scrollView).Plus(300),
         containerView.WithSameWidth(scrollView)
         );
     View.AddSubviews(scrollView);
     View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
     View.AddConstraints(
         scrollView.WithSameWidth(View),
         scrollView.WithSameHeight(View).Plus(400)
         );
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var viewModel = this.ViewModel;

            var scrollView = new UIScrollView(View.Frame)
            {
                ShowsHorizontalScrollIndicator = false,
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight
            };

            var textMessage = new UITextField {
                Placeholder = "This is the home view", BorderStyle = UITextBorderStyle.RoundedRect
            };

            Add(scrollView);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                scrollView.AtLeftOf(View),
                scrollView.AtTopOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameHeight(View));

            scrollView.Add(textMessage);

            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var constraints = scrollView.VerticalStackPanelConstraints(new Margins(20, 10, 20, 10, 5, 5), scrollView.Subviews);

            scrollView.AddConstraints(constraints);
        }
        private void AddView(UIStackView view)
        {
            if (_constraints != null)
            {
                _scrollView.RemoveConstraints(_constraints);
            }

            if (_scrollView.Subviews.Length > 0)
            {
                _scrollView.Subviews.FirstOrDefault().RemoveFromSuperview();
            }

            _scrollView.AddSubview(view);

            _constraints = new NSLayoutConstraint[]
            {
                NSLayoutConstraint.Create(view, NSLayoutAttribute.Leading, NSLayoutRelation.Equal, _scrollView, NSLayoutAttribute.Leading, 1, 0),
                NSLayoutConstraint.Create(view, NSLayoutAttribute.Width, NSLayoutRelation.Equal, _scrollView, NSLayoutAttribute.Width, 1, 0),
                NSLayoutConstraint.Create(view, NSLayoutAttribute.Trailing, NSLayoutRelation.Equal, _scrollView, NSLayoutAttribute.Trailing, 1, 0),
                NSLayoutConstraint.Create(view, NSLayoutAttribute.Top, NSLayoutRelation.Equal, _scrollView, NSLayoutAttribute.Top, 1, 0),
                NSLayoutConstraint.Create(view, NSLayoutAttribute.Bottom, NSLayoutRelation.LessThanOrEqual, _scrollView, NSLayoutAttribute.Bottom, 1, 0)
            };

            _scrollView.AddConstraints(_constraints);

            ScaleView();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var scrollView = new UIScrollView(View.Frame)
            {
                ShowsHorizontalScrollIndicator = false,
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight
            };

            // create a binding set for the appropriate view model
            var set = this.CreateBindingSet <MenuView, MenuViewModel>();

            var homeButton = new UIButton(new CGRect(0, 100, 320, 40));

            homeButton.SetTitle("Home", UIControlState.Normal);
            homeButton.BackgroundColor = UIColor.White;
            homeButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            set.Bind(homeButton).To(vm => vm.ShowHomeCommand);

            var settingsButton = new UIButton(new CGRect(0, 100, 320, 40));

            settingsButton.SetTitle("Settings", UIControlState.Normal);
            settingsButton.BackgroundColor = UIColor.White;
            settingsButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            set.Bind(settingsButton).To(vm => vm.ShowSettingCommand);

            var helpButton = new UIButton(new CGRect(0, 100, 320, 40));

            helpButton.SetTitle("Help & Feedback", UIControlState.Normal);
            helpButton.BackgroundColor = UIColor.White;
            helpButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            set.Bind(helpButton).To(vm => vm.ShowHelpCommand);

            set.Apply();

            Add(scrollView);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                scrollView.AtLeftOf(View),
                scrollView.AtTopOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameHeight(View));

            scrollView.Add(homeButton);
            scrollView.Add(settingsButton);
            scrollView.Add(helpButton);

            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var constraints = scrollView.VerticalStackPanelConstraints(new Margins(20, 10, 20, 10, 5, 5), scrollView.Subviews);

            scrollView.AddConstraints(constraints);
        }
Example #7
0
        /// <summary>
        /// Called after the controller’s <see cref="P:UIKit.UIViewController.View"/> is loaded into memory.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This method is called after <c>this</c> <see cref="T:UIKit.UIViewController"/>'s <see cref="P:UIKit.UIViewController.View"/> and its entire view hierarchy have been loaded into memory. This method is called whether the <see cref="T:UIKit.UIView"/> was loaded from a .xib file or programmatically.
        /// </para>
        /// </remarks>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var centerButton = new UIButton(new CGRect(0, 100, 320, 40));

            centerButton.SetTitle("Master View Menu Item", UIControlState.Normal);
            centerButton.BackgroundColor = UIColor.White;
            centerButton.SetTitleColor(UIColor.Black, UIControlState.Normal);

            var exampleButton = new UIButton(new CGRect(0, 100, 320, 40));

            exampleButton.SetTitle("Example Menu Item", UIControlState.Normal);
            exampleButton.BackgroundColor = UIColor.White;
            exampleButton.SetTitleColor(UIColor.Black, UIControlState.Normal);


            var bindingSet = this.CreateBindingSet <LeftPanelView, LeftPanelViewModel>();

            bindingSet.Bind(exampleButton).To(vm => vm.ShowExampleMenuItemCommand);
            bindingSet.Bind(centerButton).To(vm => vm.ShowMasterViewCommand);
            bindingSet.Apply();

            var scrollView = new UIScrollView(View.Frame)
            {
                ShowsHorizontalScrollIndicator = false,
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight
            };

            Add(scrollView);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                scrollView.AtLeftOf(View),
                scrollView.AtTopOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameHeight(View));

            scrollView.AddSubviews(centerButton, exampleButton);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var constraints = scrollView.VerticalStackPanelConstraints(new Margins(20, 10, 20, 10, 5, 5), scrollView.Subviews);

            scrollView.AddConstraints(constraints);
        }
Example #8
0
        /// <summary>
        /// Called after the controller’s <see cref="P:UIKit.UIViewController.View"/> is loaded into memory.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This method is called after <c>this</c> <see cref="T:UIKit.UIViewController"/>'s <see cref="P:UIKit.UIViewController.View"/> and its entire view hierarchy have been loaded into memory. This method is called whether the <see cref="T:UIKit.UIView"/> was loaded from a .xib file or programmatically.
        /// </para>
        /// </remarks>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var viewModel = this.ViewModel;

            var scrollView = new UIScrollView(View.Frame)
            {
                ShowsHorizontalScrollIndicator = false,
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight
            };

            var textEmail = new UITextField {
                Placeholder = "Username", BorderStyle = UITextBorderStyle.RoundedRect
            };
            var textPassword = new UITextField {
                Placeholder = "Your password", BorderStyle = UITextBorderStyle.RoundedRect, SecureTextEntry = true
            };
            var loginButton = new UIButton(UIButtonType.RoundedRect);

            loginButton.SetTitle("Log in", UIControlState.Normal);
            loginButton.BackgroundColor = UIColor.White;

            var set = this.CreateBindingSet <LoginView, LoginViewModel>();

            set.Bind(textEmail).To(vm => vm.Username);
            set.Bind(textPassword).To(vm => vm.Password);
            set.Bind(loginButton).To(vm => vm.LoginCommand);
            set.Apply();

            Add(scrollView);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                scrollView.AtLeftOf(View),
                scrollView.AtTopOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameHeight(View));

            scrollView.Add(textEmail);
            scrollView.Add(textPassword);
            scrollView.Add(loginButton);

            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var constraints = scrollView.VerticalStackPanelConstraints(new Margins(20, 10, 20, 10, 5, 5), scrollView.Subviews);

            scrollView.AddConstraints(constraints);
        }
Example #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var viewModel = this.ViewModel;

            var scrollView = new UIScrollView(View.Frame)
            {
                ShowsHorizontalScrollIndicator = false,
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight
            };
            var label = new UILabel();

            label.Text = "Info View";
            var thirdButton = new UIButton();

            thirdButton.SetTitle("Show Third ViewModel", UIControlState.Normal);
            thirdButton.BackgroundColor = UIColor.Blue;
            scrollView.AddSubviews(label, thirdButton);

            Add(scrollView);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                scrollView.AtLeftOf(View),
                scrollView.AtTopOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameHeight(View));
            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var set = this.CreateBindingSet <InfoView, InfoViewModel>();

            set.Bind(thirdButton).To(vm => vm.ShowThirdViewModelCommand);
            set.Apply();

            scrollView.AddConstraints(

                label.Below(scrollView).Plus(10),
                label.WithSameWidth(scrollView),
                label.WithSameLeft(scrollView),

                thirdButton.Below(label).Plus(10),
                thirdButton.WithSameWidth(label),
                thirdButton.WithSameLeft(label)
                );
        }
Example #10
0
        /// <summary>
        /// Called after the controller’s <see cref="P:UIKit.UIViewController.View"/> is loaded into memory.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This method is called after <c>this</c> <see cref="T:UIKit.UIViewController"/>'s <see cref="P:UIKit.UIViewController.View"/> and its entire view hierarchy have been loaded into memory. This method is called whether the <see cref="T:UIKit.UIView"/> was loaded from a .xib file or programmatically.
        /// </para>
        /// </remarks>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.Gray;

            EdgesForExtendedLayout = UIRectEdge.None;

            // setup the keyboard handling
            InitKeyboardHandling();

            var scrollView = new UIScrollView();

            Add(scrollView);
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(

                scrollView.AtTopOf(View),
                scrollView.AtLeftOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameHeight(View)

                );

            for (int i = 1; i < 8; i++)
            {
                var textField = new UITextField
                {
                    BorderStyle = UITextBorderStyle.RoundedRect,
                    Placeholder = $"Text Field {i}"
                };

                scrollView.Add(textField);
            }

            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var constraints = scrollView.VerticalStackPanelConstraints(new Margins(15, 15, 15, 15, 5, 80), scrollView.Subviews);

            scrollView.AddConstraints(constraints);
        }
Example #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var viewModel = this.ViewModel;

            var scrollView = new UIScrollView(View.Frame)
            {
                ShowsHorizontalScrollIndicator = false,
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight
            };

            var infoButton = new UIButton();

            infoButton.SetTitle("Show Info ViewModel", UIControlState.Normal);
            infoButton.BackgroundColor = UIColor.Blue;
            scrollView.AddSubviews(infoButton);

            Add(scrollView);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                scrollView.AtLeftOf(View),
                scrollView.AtTopOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameHeight(View));
            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var set = this.CreateBindingSet <TrackView, TrackViewModel>();

            set.Bind(infoButton).To("GoToInfoCommand");
            set.Apply();

            scrollView.AddConstraints(

                infoButton.Below(scrollView).Plus(10),
                infoButton.WithSameWidth(scrollView),
                infoButton.WithSameLeft(scrollView)
                );
        }
Example #12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(77, 210, 255);

            //save user
            _filePath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "ToDoUser.txt");
            File.WriteAllText(_filePath, $"{SignViewModel.UserCurrent.UserLogin}`" +
                              $"{SignViewModel.UserCurrent.UserPassword}");

            _contentConteiner = new UIView();
            _scrollView       = new UIScrollView();
            _scrollView.AddSubview(_contentConteiner);
            Add(_scrollView);

            _titleView = new UIView();
            _titleView.BackgroundColor    = UIColor.FromRGB(245, 245, 239);
            _titleView.Layer.CornerRadius = 10;
            _contentConteiner.AddSubview(_titleView);

            _userImage = new UIImageView();
            _userImage.BackgroundColor = UIColor.LightGray;
            _contentConteiner.AddSubview(_userImage);

            _imageButton = new UIButton();
            _imageButton.BackgroundColor = UIColor.Clear;
            _imageButton.TouchUpInside  += ChoosePicture;
            _contentConteiner.AddSubview(_imageButton);

            _userLogin = new UILabel();
            _contentConteiner.AddSubview(_userLogin);

            _home = new UIButton();
            _home.SetTitle("Task List", UIControlState.Normal);
            _home.SetTitleColor(UIColor.Black, UIControlState.Normal);
            _home.TitleLabel.ShadowOffset        = new CGSize(width: 0, height: 0.1);
            _home.TitleLabel.Layer.ShadowOpacity = 1;
            _home.TitleLabel.Layer.ShadowRadius  = 8;
            _home.TitleLabel.Layer.MasksToBounds = false;
            _home.SetImage(UIImage.FromFile("Image/todoIOS.png"), UIControlState.Normal);
            _home.TouchUpInside += delegate { File.Delete(_filePath);
                                              ViewModel.GoHome();
                                              Mvx.Resolve <IMvxSideMenu>().Close(); };
            _contentConteiner.AddSubview(_home);

            _logOff = new UIButton();
            _logOff.SetTitle("LogOff", UIControlState.Normal);
            _logOff.SetTitleColor(UIColor.Black, UIControlState.Normal);
            _logOff.TitleLabel.ShadowOffset        = new CGSize(width: 0, height: 0.1);
            _logOff.TitleLabel.Layer.ShadowOpacity = 1;
            _logOff.TitleLabel.Layer.ShadowRadius  = 8;
            _logOff.TitleLabel.Layer.MasksToBounds = false;
            _logOff.SetImage(UIImage.FromFile("Image/logoffIOS.png"), UIControlState.Normal);
            _logOff.TouchUpInside += delegate { File.Delete(_filePath);
                                                ViewModel.DoLogOff();
                                                Mvx.Resolve <IMvxSideMenu>().Close(); };
            _contentConteiner.AddSubview(_logOff);

            var set = this.CreateBindingSet <LeftPanelView, LeftPanelViewModel>();

            set.Bind(_userImage).For(v => v.Image).To(vm => vm.UserImage).WithConversion("ByteToUIImage");
            set.Bind(_userLogin).To(vm => vm.UserLogin);
            set.Apply();

            //conastraint
            _scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            _scrollView.AddConstraints(_contentConteiner.FullWidthOf(_scrollView));
            _scrollView.AddConstraints(_contentConteiner.FullHeightOf(_scrollView));

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(_scrollView.FullWidthOf(View));
            View.AddConstraints(_scrollView.FullHeightOf(View));
            View.AddConstraints(
                _contentConteiner.WithSameWidth(View),
                _contentConteiner.WithSameHeight(View).SetPriority(UILayoutPriority.DefaultLow)
                );

            _contentConteiner.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            _contentConteiner.AddConstraints(
                _titleView.WithSameCenterX(_contentConteiner),
                _titleView.AtTopOf(_contentConteiner).Plus(20),
                _titleView.Height().EqualTo(250),
                _titleView.WithSameWidth(_contentConteiner).Minus(10),

                _userImage.WithSameCenterX(_titleView),
                _userImage.WithSameCenterY(_titleView),
                _userImage.Height().EqualTo(120),
                _userImage.Width().EqualTo(120),

                _imageButton.Height().EqualTo(120),
                _imageButton.Width().EqualTo(120),
                _imageButton.WithSameCenterX(_userImage),
                _imageButton.WithSameCenterY(_userImage),

                _userLogin.Below(_userImage, 10),
                _userLogin.WithSameCenterX(_userImage),

                _home.Below(_userLogin, 50),
                _home.AtLeftOf(_contentConteiner, 5),

                _logOff.Below(_home, 5),
                _logOff.AtLeftOf(_contentConteiner, 5)
                );

            // very important to make scrolling work
            var bottomViewConstraint = _contentConteiner.Subviews.Last()
                                       .AtBottomOf(_contentConteiner).Minus(20);

            _contentConteiner.AddConstraints(bottomViewConstraint);
        }
        /// <summary>
        /// Opens data visualizer with the detected <see cref="Observation"/>s.
        /// </summary>
        private void OpenDataVisualizer()
        {
            if (_dataVisualizerOpened)
            {
                return;
            }

            _dataVisualizerOpened = true;

            var allDataPoints = new List <Dictionary <Category, int> >();
            var allCategories = new HashSet <Category>();

            foreach (var imageEntry in InputImageEntries)
            {
                UpdateCategoryColors(imageEntry);
                var dataPoints = new Dictionary <Category, int>();
                foreach (var observation in imageEntry.Observations)
                {
                    if (dataPoints.ContainsKey(observation.Category))
                    {
                        dataPoints[observation.Category]++;
                    }
                    else
                    {
                        dataPoints.Add(observation.Category, 1);
                    }

                    allCategories.Add(observation.Category);
                }
                allDataPoints.Add(dataPoints);
            }

            _dataVisualizer = new BarChartSeries(allDataPoints, allCategories);
            _dataVisualizer.Update(allCategories.Where(category => SidebarController.CheckboxState[category]),
                                   new Category[] { }, View);

            ThumbnailViewHeight = Constants.TimeLineScrollViewHeight + Constants.BarChartSeriesStackViewHeight +
                                  Constants.LegendHeight;

            _timeLineScrollView.Frame = new CGRect(Constants.Origin,
                                                   View.Frame.Height - Constants.ResultsToolBarHeight - ThumbnailViewHeight + Constants.LegendHeight,
                                                   View.Frame.Width, ThumbnailViewHeight);

            CalculateScaledDimensions(InputImageEntry.Image);
            ImageView.Frame = new CGRect(0, 0, ImgWidth, ImgHeight);

            UpdateScrollViewDimensions();

            UpdateBoundingBoxes();

            var barChartsTopConstraint = NSLayoutConstraint.Create(_dataVisualizer.Chart, NSLayoutAttribute.Top,
                                                                   NSLayoutRelation.Equal, _timeLineScrollView, NSLayoutAttribute.Top, 1f, 0f);
            var barChartsLeadingConstraint = NSLayoutConstraint.Create(_dataVisualizer.Chart, NSLayoutAttribute.Leading,
                                                                       NSLayoutRelation.Equal, _timeLineScrollView, NSLayoutAttribute.Leading, 1f, 0f);

            _timeLineScrollView.AddSubview(_dataVisualizer.Chart);
            _timeLineScrollView.AddConstraints(new[]
            {
                barChartsTopConstraint,
                barChartsLeadingConstraint
            });

            _thumbnailStackView.Frame = new CGRect(Constants.Origin,
                                                   Constants.BarChartSeriesStackViewHeight,
                                                   Constants.TotalThumbnailWidth * InputImageEntries.Count,
                                                   Constants.ThumbnailHeight);

            _subHeadingStackView.Frame = new CGRect(Constants.Origin,
                                                    Constants.BarChartSeriesStackViewHeight,
                                                    Constants.TotalThumbnailWidth * InputImageEntries.Count,
                                                    Constants.SubheadingViewHeight);

            _legendScrollView = new UIScrollView(new CGRect(0, 0, View.Frame.Width, Constants.LegendHeight))
            {
                ContentSize            = new CGSize(_dataVisualizer.Legend.Frame.Width, Constants.LegendHeight),
                BackgroundColor        = Constants.LegendViewColour,
                UserInteractionEnabled = true,
                ScrollEnabled          = true
            };

            _legendView = new UIView(new CGRect(Constants.Origin,
                                                View.Frame.Height - Constants.ResultsToolBarHeight - ThumbnailViewHeight,
                                                View.Frame.Width, Constants.LegendHeight))
            {
                BackgroundColor        = Constants.LegendViewColour,
                UserInteractionEnabled = true
            };

            View.AddSubview(_legendView);

            var legendLeadingConstraint = NSLayoutConstraint.Create(_dataVisualizer.Legend,
                                                                    NSLayoutAttribute.LeadingMargin, NSLayoutRelation.Equal, _legendScrollView,
                                                                    NSLayoutAttribute.LeadingMargin, 1f, 0f);
            var legendCenterYConstraint = NSLayoutConstraint.Create(_dataVisualizer.Legend, NSLayoutAttribute.CenterY,
                                                                    NSLayoutRelation.Equal, _legendScrollView, NSLayoutAttribute.CenterY, 1f, 0f);

            _legendScrollView.AddSubview(_dataVisualizer.Legend);
            _legendScrollView.AddConstraints(new[]
            {
                legendLeadingConstraint,
                legendCenterYConstraint
            });

            _dataVisualizerCloseButton = new UIButton(UIButtonType.System)
            {
                TintColor = Constants.CloseBtnColor
            };
            _dataVisualizerCloseButton.SetImage(new UIImage(Constants.CloseBtnImage), UIControlState.Normal);
            _dataVisualizerCloseButton.SizeToFit();

            _dataVisualizerCloseButton.Frame = new CGRect(
                View.Frame.Width - _dataVisualizerCloseButton.Frame.Width - Constants.CloseButtonMargin,
                (Constants.LegendHeight - _dataVisualizerCloseButton.Frame.Height) / 2,
                _dataVisualizerCloseButton.Frame.Width,
                _dataVisualizerCloseButton.Frame.Height);

            ConfigureDataVisualizeCloseButtonAccessibilityAttribute(_dataVisualizerCloseButton);

            _legendScrollView.Frame = new CGRect(0, 0,
                                                 View.Frame.Width - _dataVisualizerCloseButton.Frame.Width - Constants.CloseButtonMargin * 2,
                                                 Constants.LegendHeight);

            _legendView.AddSubview(_legendScrollView);
            _legendView.AddSubview(_dataVisualizerCloseButton);

            _dataVisualizerCloseButton.TouchUpInside += DataVisualizerCloseButton_TouchUpInside;

            _legendScrollView.BringSubviewToFront(_dataVisualizerCloseButton);
        }
        public override void LoadView ()
        {
            durationButton = new UIButton ().Apply (Style.NavTimer.DurationButton);
            durationButton.SetTitle (DefaultDurationText, UIControlState.Normal); // Dummy content to use for sizing of the label
            durationButton.SizeToFit ();
            durationButton.TouchUpInside += OnDurationButtonTouchUpInside;
            NavigationItem.TitleView = durationButton;

            var scrollView = new UIScrollView ().Apply (Style.Screen);

            scrollView.Add (wrapper = new UIView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });

            wrapper.Add (startStopView = new StartStopView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                StartTime = ViewModel.StartDate,
                StopTime = ViewModel.StopDate,
            });
            startStopView.SelectedChanged += OnStartStopViewSelectedChanged;

            wrapper.Add (datePicker = new UIDatePicker {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = DatePickerHidden,
                Alpha = 0,
            } .Apply (Style.EditTimeEntry.DatePicker));
            datePicker.ValueChanged += OnDatePickerValueChanged;

            wrapper.Add (projectButton = new ProjectClientTaskButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });
            projectButton.TouchUpInside += OnProjectButtonTouchUpInside;

            wrapper.Add (descriptionTextField = new TextField {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString (
                    "EditEntryDesciptionTimerHint".Tr (),
                    foregroundColor: Color.Gray
                ),
                ShouldReturn = tf => tf.ResignFirstResponder (),
            } .Apply (Style.EditTimeEntry.DescriptionField));

            descriptionTextField.ShouldBeginEditing += (s) => {
                ForceDimissDatePicker();
                return true;
            };
            descriptionTextField.ShouldEndEditing += s => {
                return true;
            };

            wrapper.Add (tagsButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            } .Apply (Style.EditTimeEntry.TagsButton));
            tagsButton.TouchUpInside += OnTagsButtonTouchUpInside;

            wrapper.Add (billableSwitch = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "EditEntryBillable".Tr (),
            } .Apply (Style.EditTimeEntry.BillableContainer));
            billableSwitch.Label.Apply (Style.EditTimeEntry.BillableLabel);

            wrapper.Add (deleteButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            } .Apply (Style.EditTimeEntry.DeleteButton));
            deleteButton.SetTitle ("EditEntryDelete".Tr (), UIControlState.Normal);
            deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside;

            ResetWrapperConstraints ();
            scrollView.AddConstraints (
                wrapper.AtTopOf (scrollView),
                wrapper.AtBottomOf (scrollView),
                wrapper.AtLeftOf (scrollView),
                wrapper.AtRightOf (scrollView),
                wrapper.WithSameWidth (scrollView),
                wrapper.Height ().GreaterThanOrEqualTo ().HeightOf (scrollView).Minus (64f),
                null
            );

            View = scrollView;
        }
Example #15
0
        public override void LoadView()
        {
            var scrollView = new UIScrollView().Apply(Style.Screen);

            scrollView.Add(wrapper = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });

            wrapper.Add(startStopView = new StartStopView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                StartTime = model.StartTime,
                StopTime  = model.StopTime,
            }.Apply(BindStartStopView));
            startStopView.SelectedChanged += OnStartStopViewSelectedChanged;

            wrapper.Add(datePicker = new UIDatePicker()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = DatePickerHidden,
                Alpha  = 0,
            }.Apply(Style.EditTimeEntry.DatePicker).Apply(BindDatePicker));
            datePicker.ValueChanged += OnDatePickerValueChanged;

            wrapper.Add(projectButton = new ProjectClientTaskButton()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply(BindProjectButton));
            projectButton.TouchUpInside += OnProjectButtonTouchUpInside;

            wrapper.Add(descriptionTextField = new TextField()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString(
                    "EditEntryDesciptionTimerHint".Tr(),
                    foregroundColor: Color.Gray
                    ),
                ShouldReturn = (tf) => tf.ResignFirstResponder(),
            }.Apply(Style.EditTimeEntry.DescriptionField).Apply(BindDescriptionField));
            descriptionTextField.EditingChanged += OnDescriptionFieldEditingChanged;
            descriptionTextField.EditingDidEnd  += (s, e) => CommitDescriptionChanges();

            wrapper.Add(tagsButton = new UIButton()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply(Style.EditTimeEntry.TagsButton).Apply(BindTagsButton));
            tagsButton.TouchUpInside += OnTagsButtonTouchUpInside;

            wrapper.Add(billableSwitch = new LabelSwitchView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "EditEntryBillable".Tr(),
            }.Apply(Style.EditTimeEntry.BillableContainer).Apply(BindBillableSwitch));
            billableSwitch.Label.Apply(Style.EditTimeEntry.BillableLabel);
            billableSwitch.Switch.ValueChanged += OnBillableSwitchValueChanged;

            wrapper.Add(deleteButton = new UIButton()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply(Style.EditTimeEntry.DeleteButton));
            deleteButton.SetTitle("EditEntryDelete".Tr(), UIControlState.Normal);
            deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside;

            wrapper.AddConstraints(VerticalLinearLayout(wrapper));
            scrollView.AddConstraints(
                wrapper.AtTopOf(scrollView),
                wrapper.AtBottomOf(scrollView),
                wrapper.AtLeftOf(scrollView),
                wrapper.AtRightOf(scrollView),
                wrapper.WithSameWidth(scrollView),
                wrapper.Height().GreaterThanOrEqualTo().HeightOf(scrollView).Minus(64f),
                null
                );

            View = scrollView;
        }
        protected override void InitializeObjects()
        {
            base.InitializeObjects();

            var topView           = new UIView();
            var scrollView        = new UIScrollView();
            var topTextRowView    = new UIView();
            var centerTextRowView = new UIView();
            var bottomTextRowView = new UIView();
            var bottomView        = new UIView();
            var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png"));

            backHomeView = UIButton.FromType(UIButtonType.Custom);
            backHomeView.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal);
            nameOfPageLabel           = LabelInformationAboutPage(UIColor.White, "Profile", UIFont.BoldSystemFontOfSize(16f));
            informationAboutPageLabel = LabelInformationAboutPage(UIColor.FromRGB(29, 157, 189), "Please, Enter Your Personal Information.", UIFont.FromName("Helvetica", 14f));

            // Hide navigation bar
            NavigationController.SetNavigationBarHidden(true, false);
            View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size));
            profileNavigationBarBackground.Frame = new CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height);

            var labelView = new UIView();

            labelView.AddIfNotNull(nameOfPageLabel, informationAboutPageLabel);
            labelView.AddConstraints(
                nameOfPageLabel.AtTopOf(labelView, 20),
                nameOfPageLabel.WithSameCenterX(labelView),
                nameOfPageLabel.WithSameCenterY(labelView),
                nameOfPageLabel.WithSameWidth(labelView),
                nameOfPageLabel.WithRelativeHeight(labelView, 0.3f),

                informationAboutPageLabel.Below(nameOfPageLabel, 5),
                informationAboutPageLabel.WithSameWidth(labelView),
                informationAboutPageLabel.WithSameCenterX(labelView),
                informationAboutPageLabel.WithRelativeHeight(labelView, 0.3f)
                );

            topView.AddIfNotNull(profileNavigationBarBackground, backHomeView, labelView);
            topView.AddConstraints(
                profileNavigationBarBackground.WithSameWidth(topView),
                profileNavigationBarBackground.WithSameHeight(topView),
                profileNavigationBarBackground.AtTopOf(topView),

                backHomeView.WithSameCenterY(topView),
                backHomeView.AtLeftOf(topView, 20),
                backHomeView.WithRelativeWidth(topView, 0.1f),
                backHomeView.WithRelativeHeight(topView, 0.2f),

                labelView.WithSameCenterX(topView),
                labelView.WithSameCenterY(topView),
                labelView.WithRelativeWidth(topView, 0.8f),
                labelView.WithRelativeHeight(topView, 0.6f)
                );

            firstNameTextField = TextFieldInitializer("First Name");
            lastNameTextField  = TextFieldInitializer("Last Name");
            emailTextField     = TextFieldInitializer("Email");
            addressTextField   = TextFieldInitializer("Address");
            cityTextField      = TextFieldInitializer("City");
            zipCodeTextField   = TextFieldInitializer("Zip Code");

            stateTextField        = TextFieldInitializer("State");
            statesPicker          = new UIPickerView();
            statesPickerViewModel = new MvxPickerViewModel(statesPicker);
            statesPicker.Model    = statesPickerViewModel;
            statesPicker.ShowSelectionIndicator = true;
            statesPicker.BackgroundColor        = UIColor.White;


            addLicenseButton    = ProfileButtonManager.ButtonInitiaziler("Add License Plate", UIImage.FromFile(@"Images/ProfileView/ic_license.png"));
            addCreditCardButton = ProfileButtonManager.ButtonInitiaziler("Add Credit Card", UIImage.FromFile(@"Images/ProfileView/ic_card.png"));

            topTextRowView.AddIfNotNull(firstNameTextField, lastNameTextField);
            topTextRowView.AddConstraints(
                firstNameTextField.AtTopOf(topTextRowView),
                firstNameTextField.AtLeftOf(topTextRowView),
                firstNameTextField.WithRelativeWidth(topTextRowView, 0.475f),
                firstNameTextField.WithSameHeight(topTextRowView),

                lastNameTextField.AtTopOf(topTextRowView),
                lastNameTextField.AtRightOf(topTextRowView),
                lastNameTextField.WithRelativeWidth(topTextRowView, 0.475f),
                lastNameTextField.WithSameHeight(topTextRowView)
                );

            centerTextRowView.AddIfNotNull(emailTextField, addressTextField, cityTextField);
            centerTextRowView.AddConstraints(
                emailTextField.AtTopOf(centerTextRowView),
                emailTextField.WithSameCenterX(centerTextRowView),
                emailTextField.WithSameWidth(centerTextRowView),
                emailTextField.WithRelativeHeight(centerTextRowView, 0.3f),

                addressTextField.Below(emailTextField, 10),
                addressTextField.WithSameCenterX(centerTextRowView),
                addressTextField.WithSameWidth(centerTextRowView),
                addressTextField.WithRelativeHeight(centerTextRowView, 0.3f),

                cityTextField.Below(addressTextField, 10),
                cityTextField.WithSameCenterX(centerTextRowView),
                cityTextField.WithSameWidth(centerTextRowView),
                cityTextField.WithRelativeHeight(centerTextRowView, 0.3f)
                );

            bottomTextRowView.AddIfNotNull(stateTextField, zipCodeTextField);
            bottomTextRowView.AddConstraints(
                stateTextField.AtTopOf(bottomTextRowView),
                stateTextField.AtLeftOf(bottomTextRowView),
                stateTextField.WithRelativeWidth(bottomTextRowView, 0.475f),
                stateTextField.WithSameHeight(bottomTextRowView),

                zipCodeTextField.AtTopOf(bottomTextRowView),
                zipCodeTextField.AtRightOf(bottomTextRowView),
                zipCodeTextField.WithRelativeWidth(bottomTextRowView, 0.475f),
                zipCodeTextField.WithSameHeight(bottomTextRowView)
                );

            bottomView.AddIfNotNull(addLicenseButton, addCreditCardButton);
            bottomView.AddConstraints(
                addLicenseButton.AtTopOf(bottomView),
                addLicenseButton.WithSameCenterX(bottomView),
                addLicenseButton.WithSameWidth(bottomView),
                addLicenseButton.WithRelativeHeight(bottomView, 0.4f),

                addCreditCardButton.Below(addLicenseButton, 10),
                addCreditCardButton.WithSameCenterX(bottomView),
                addCreditCardButton.WithSameWidth(bottomView),
                addCreditCardButton.WithRelativeHeight(bottomView, 0.4f)
                );

            scrollView.AddIfNotNull(topTextRowView, centerTextRowView, bottomTextRowView, bottomView);
            scrollView.AddConstraints(
                topTextRowView.AtTopOf(scrollView, 30),
                topTextRowView.WithSameWidth(scrollView),
                topTextRowView.WithSameCenterX(scrollView),
                topTextRowView.WithRelativeHeight(scrollView, 0.12f),

                centerTextRowView.Below(topTextRowView, 10),
                centerTextRowView.WithSameWidth(scrollView),
                centerTextRowView.AtLeftOf(scrollView),
                centerTextRowView.AtRightOf(scrollView),
                centerTextRowView.WithRelativeHeight(scrollView, 0.4f),

                bottomTextRowView.Below(centerTextRowView, 10),
                bottomTextRowView.WithSameWidth(scrollView),
                bottomTextRowView.WithSameCenterX(scrollView),
                bottomTextRowView.WithRelativeHeight(scrollView, 0.12f),

                bottomView.Below(bottomTextRowView, 10),
                bottomView.WithSameWidth(scrollView),
                bottomView.AtLeftOf(scrollView),
                bottomView.AtRightOf(scrollView),
                bottomView.AtBottomOf(scrollView, 100),
                bottomView.WithRelativeHeight(scrollView, 0.27f)
                );

            View.AddIfNotNull(topView, scrollView);
            View.AddConstraints(
                topView.AtTopOf(View),
                topView.WithSameWidth(View),
                topView.WithRelativeHeight(View, 0.2f),

                scrollView.Below(topView, 30),
                scrollView.AtLeftOf(View, 30),
                scrollView.AtRightOf(View, 30),
                scrollView.WithRelativeHeight(View, 0.8f)
                );
            EnableNextKeyForTextFields(firstNameTextField.TextFieldWithValidator.TextField, lastNameTextField.TextFieldWithValidator.TextField, emailTextField.TextFieldWithValidator.TextField,
                                       addressTextField.TextFieldWithValidator.TextField, cityTextField.TextFieldWithValidator.TextField, stateTextField.TextFieldWithValidator.TextField,
                                       zipCodeTextField.TextFieldWithValidator.TextField);
        }
        public override void LoadView ()
        {
            var scrollView = new UIScrollView ().Apply (Style.Screen);

            scrollView.Add (wrapper = new UIView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });

            wrapper.Add (startStopView = new StartStopView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                StartTime = model.StartTime,
                StopTime = model.StopTime,
            }.Apply (BindStartStopView));
            startStopView.SelectedChanged += OnStartStopViewSelectedChanged;

            wrapper.Add (datePicker = new UIDatePicker () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = DatePickerHidden,
                Alpha = 0,
            }.Apply (Style.EditTimeEntry.DatePicker).Apply (BindDatePicker));
            datePicker.ValueChanged += OnDatePickerValueChanged;

            wrapper.Add (projectButton = new ProjectClientTaskButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (BindProjectButton));
            projectButton.TouchUpInside += OnProjectButtonTouchUpInside;

            wrapper.Add (descriptionTextField = new TextField () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString (
                    "EditEntryDesciptionTimerHint".Tr (),
                    foregroundColor: Color.Gray
                ),
                ShouldReturn = (tf) => tf.ResignFirstResponder (),
            }.Apply (Style.EditTimeEntry.DescriptionField).Apply (BindDescriptionField));
            descriptionTextField.EditingChanged += OnDescriptionFieldEditingChanged;
            descriptionTextField.EditingDidEnd += (s, e) => CommitDescriptionChanges ();

            wrapper.Add (tagsButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.EditTimeEntry.TagsButton).Apply (BindTagsButton));
            tagsButton.TouchUpInside += OnTagsButtonTouchUpInside;

            wrapper.Add (billableSwitch = new LabelSwitchView () {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "EditEntryBillable".Tr (),
            }.Apply (Style.EditTimeEntry.BillableContainer).Apply (BindBillableSwitch));
            billableSwitch.Label.Apply (Style.EditTimeEntry.BillableLabel);
            billableSwitch.Switch.ValueChanged += OnBillableSwitchValueChanged;

            wrapper.Add (deleteButton = new UIButton () {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply (Style.EditTimeEntry.DeleteButton));
            deleteButton.SetTitle ("EditEntryDelete".Tr (), UIControlState.Normal);
            deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside;

            wrapper.AddConstraints (VerticalLinearLayout (wrapper));
            scrollView.AddConstraints (
                wrapper.AtTopOf (scrollView),
                wrapper.AtBottomOf (scrollView),
                wrapper.AtLeftOf (scrollView),
                wrapper.AtRightOf (scrollView),
                wrapper.WithSameWidth (scrollView),
                wrapper.Height ().GreaterThanOrEqualTo ().HeightOf (scrollView).Minus (64f),
                null
            );

            View = scrollView;
        }
        protected override void InitializeObjects()
        {
            base.InitializeObjects();

            var topView        = new UIView();
            var scrollView     = new UIScrollView();
            var topTextRowView = new UIView();

            backHomeView = UIButton.FromType(UIButtonType.Custom);
            backHomeView.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal);
            var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png"));

            nameOfPageLabel           = LabelInformationAboutPage(UIColor.White, "License Information", UIFont.BoldSystemFontOfSize(16f));
            informationAboutPageLabel = LabelInformationAboutPage(UIColor.FromRGB(29, 157, 189), "Please, Enter the License Plate Number and Other Information for Your Vehicle.", UIFont.FromName("Helvetica", 14f));

            // Hide navigation bar
            NavigationController.SetNavigationBarHidden(true, false);
            View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size));//EnvironmentInfo.CheckDevice().Scale(View.Frame.Size));
            profileNavigationBarBackground.Frame = new CoreGraphics.CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height);

            var labelView = new UIView();

            labelView.AddIfNotNull(nameOfPageLabel, informationAboutPageLabel);
            labelView.AddConstraints(
                nameOfPageLabel.AtTopOf(labelView, 20),
                nameOfPageLabel.WithSameCenterX(labelView),
                nameOfPageLabel.WithSameCenterY(labelView),
                nameOfPageLabel.WithSameWidth(labelView),
                nameOfPageLabel.WithRelativeHeight(labelView, 0.3f),

                informationAboutPageLabel.Below(nameOfPageLabel, 5),
                informationAboutPageLabel.WithSameWidth(labelView),
                informationAboutPageLabel.WithSameCenterX(labelView),
                informationAboutPageLabel.WithRelativeHeight(labelView, 0.6f)
                );

            topView.AddIfNotNull(profileNavigationBarBackground, backHomeView, labelView);
            topView.AddConstraints(
                profileNavigationBarBackground.WithSameWidth(topView),
                profileNavigationBarBackground.WithSameHeight(topView),
                profileNavigationBarBackground.AtTopOf(topView),

                backHomeView.WithSameCenterY(topView),
                backHomeView.AtLeftOf(topView, 20),
                backHomeView.WithRelativeWidth(topView, 0.1f),
                backHomeView.WithRelativeHeight(topView, 0.2f),

                labelView.WithSameCenterX(topView),
                labelView.WithSameCenterY(topView),
                labelView.WithRelativeWidth(topView, 0.8f),
                labelView.WithRelativeHeight(topView, 0.6f)
                );

            licensePlateTextField = TextFieldInitializer("LicensePlate");

            stateTextField        = TextFieldInitializer("State");
            statesPicker          = PickerInitializer();
            statesPickerViewModel = new MvxPickerViewModel(statesPicker);
            statesPicker.Model    = statesPickerViewModel;

            vehicleClassTextField         = TextFieldInitializer("Vehicle Class");
            vehicleClassesPicker          = PickerInitializer();
            vehicleClassesPickerViewModel = new MvxPickerViewModel(vehicleClassesPicker);
            vehicleClassesPicker.Model    = vehicleClassesPickerViewModel;

            topTextRowView.AddIfNotNull(licensePlateTextField, stateTextField, vehicleClassTextField);
            topTextRowView.AddConstraints(
                licensePlateTextField.AtTopOf(topTextRowView),
                licensePlateTextField.WithSameCenterX(topTextRowView),
                licensePlateTextField.WithSameWidth(topTextRowView),
                licensePlateTextField.WithRelativeHeight(topTextRowView, 0.3f),

                stateTextField.Below(licensePlateTextField, 10),
                stateTextField.WithSameCenterX(topTextRowView),
                stateTextField.WithSameWidth(topTextRowView),
                stateTextField.WithRelativeHeight(topTextRowView, 0.3f),

                vehicleClassTextField.Below(stateTextField, 10),
                vehicleClassTextField.WithSameCenterX(topTextRowView),
                vehicleClassTextField.WithSameWidth(topTextRowView),
                vehicleClassTextField.WithRelativeHeight(topTextRowView, 0.3f)
                );

            scrollView.AddIfNotNull(topTextRowView);
            scrollView.AddConstraints(
                topTextRowView.AtTopOf(scrollView),
                topTextRowView.WithSameWidth(scrollView),
                topTextRowView.AtLeftOf(scrollView),
                topTextRowView.AtRightOf(scrollView),
                topTextRowView.WithRelativeHeight(scrollView, 0.4f)
                );

            View.AddIfNotNull(topView, scrollView);
            View.AddConstraints(
                topView.AtTopOf(View),
                topView.WithSameWidth(View),
                topView.WithRelativeHeight(View, 0.2f),

                scrollView.Below(topView, 30),
                scrollView.AtLeftOf(View, 30),
                scrollView.AtRightOf(View, 30),
                scrollView.WithRelativeHeight(View, 0.8f)
                );

            EnableNextKeyForTextFields(licensePlateTextField.TextFieldWithValidator.TextField, stateTextField.TextFieldWithValidator.TextField, vehicleClassTextField.TextFieldWithValidator.TextField);
        }
Example #19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.FromRGB(204, 242, 255);

            _contentConteiner = new UIView();
            _scrollView       = new UIScrollView();
            _scrollView.AddSubview(_contentConteiner);
            Add(_scrollView);


            _scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            _scrollView.AddConstraints(_contentConteiner.FullWidthOf(_scrollView));
            _scrollView.AddConstraints(_contentConteiner.FullHeightOf(_scrollView));

            var _BackBarButton = new UIBarButtonItem();

            _BackBarButton.Title = string.Empty;
            NavigationItem.RightBarButtonItem = _BackBarButton;
            var _MenuBarButton = new UIBarButtonItem();

            _BackBarButton.Title             = "Back";
            NavigationItem.LeftBarButtonItem = _BackBarButton;


            _labelError           = new UILabel();
            _labelError.TextColor = UIColor.Red;
            _labelError.Font      = _labelError.Font.WithSize(10);
            _contentConteiner.AddSubview(_labelError);

            _textUserName                    = new UITextField();
            _textUserName.Placeholder        = "Login";
            _textUserName.Layer.CornerRadius = 5;
            _textUserName.Layer.BorderWidth  = 2;
            _textUserName.BorderStyle        = UITextBorderStyle.RoundedRect;
            _textUserName.ShouldReturn       = (textField) => {
                textField.ResignFirstResponder();
                return(true);
            };
            _contentConteiner.AddSubview(_textUserName);

            _textUserPassword                    = new UITextField();
            _textUserPassword.Placeholder        = "Password";
            _textUserPassword.Layer.CornerRadius = 5;
            _textUserPassword.Layer.BorderWidth  = 2;
            _textUserPassword.SecureTextEntry    = true;
            _textUserPassword.BorderStyle        = UITextBorderStyle.RoundedRect;
            _textUserPassword.ShouldReturn       = (textField) => {
                textField.ResignFirstResponder();
                return(true);
            };
            _contentConteiner.AddSubview(_textUserPassword);

            _textUserPasswordRepeat                    = new UITextField();
            _textUserPasswordRepeat.Placeholder        = "Password repeat";
            _textUserPasswordRepeat.Layer.CornerRadius = 5;
            _textUserPasswordRepeat.Layer.BorderWidth  = 2;
            _textUserPasswordRepeat.SecureTextEntry    = true;
            _textUserPasswordRepeat.BorderStyle        = UITextBorderStyle.RoundedRect;
            _textUserPasswordRepeat.ShouldReturn       = (textField) => {
                textField.ResignFirstResponder();
                return(true);
            };
            _contentConteiner.AddSubview(_textUserPasswordRepeat);

            _passwordPattern               = new UILabel();
            _passwordPattern.Text          = "password must contain at least 6 characters, min 1 letter UpperCase,min 1 digit";
            _passwordPattern.Font          = _passwordPattern.Font.WithSize(10);
            _passwordPattern.LineBreakMode = UILineBreakMode.WordWrap;
            _passwordPattern.Lines         = 0;
            _contentConteiner.AddSubview(_passwordPattern);

            _imageUserPhoto = new UIImageView();
            _imageUserPhoto.Layer.CornerRadius = this._imageUserPhoto.Frame.Size.Height / 2;
            _imageUserPhoto.ClipsToBounds      = true;
            _imageUserPhoto.BackgroundColor    = UIColor.LightGray;
            _contentConteiner.AddSubview(_imageUserPhoto);

            _buttonPhoto = new UIButton();
            _buttonPhoto.Layer.CornerRadius = this._buttonPhoto.Frame.Size.Height / 2;
            _buttonPhoto.ClipsToBounds      = true;
            _buttonPhoto.BackgroundColor    = UIColor.Clear;
            _buttonPhoto.TouchUpInside     += ChoosePicture;
            _contentConteiner.AddSubview(_buttonPhoto);

            _buttonCreate = new UIButton(UIButtonType.RoundedRect);
            _buttonCreate.SetTitle("Create", UIControlState.Normal);
            _buttonCreate.Layer.CornerRadius = 5;
            _buttonCreate.BackgroundColor    = UIColor.Blue;
            _buttonCreate.SetTitleColor(UIColor.White, UIControlState.Normal);
            _contentConteiner.AddSubview(_buttonCreate);

            var set = this.CreateBindingSet <RegistrationView, RegistrationViewModel>();

            set.Bind(_textUserName).To(vm => vm.UserLogin);
            set.Bind(_labelError).To(vm => vm.Error);
            set.Bind(_textUserPassword).To(vm => vm.UserPassword);
            set.Bind(_textUserPasswordRepeat).To(vm => vm.UserPasswordRepeat);
            set.Bind(_buttonCreate).To(vm => vm.CreateUserCommand);
            set.Bind(_imageUserPhoto).For(v => v.Image).To(vm => vm.UserImage).WithConversion("ByteToUIImage");
            set.Bind(_BackBarButton).To(vm => vm.BackToCommand);
            set.Apply();

            //conastraint
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(_scrollView.FullWidthOf(View));
            View.AddConstraints(_scrollView.FullHeightOf(View));
            View.AddConstraints(
                _contentConteiner.WithSameWidth(View),
                _contentConteiner.WithSameHeight(View).SetPriority(UILayoutPriority.DefaultLow)
                );

            _contentConteiner.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            _contentConteiner.AddConstraints(

                _labelError.WithSameCenterX(_contentConteiner),
                //_labelError.WithSameWidth(_contentConteiner).Minus(100),
                _labelError.AtTopOf(_contentConteiner),
                _labelError.Height().EqualTo(13),

                _textUserName.AtLeftOf(_contentConteiner, 25),
                _textUserName.WithSameWidth(_contentConteiner).Minus(135),
                _textUserName.Below(_labelError, 60),

                _textUserPassword.AtLeftOf(_contentConteiner, 25),
                _textUserPassword.WithSameWidth(_contentConteiner).Minus(135),
                _textUserPassword.Below(_textUserName, 40),

                _textUserPasswordRepeat.AtLeftOf(_contentConteiner, 25),
                _textUserPasswordRepeat.WithSameWidth(_contentConteiner).Minus(135),
                _textUserPasswordRepeat.Below(_textUserPassword, 40),

                _imageUserPhoto.AtRightOf(_contentConteiner, 25),
                _imageUserPhoto.WithSameCenterY(_textUserName),
                _imageUserPhoto.Width().EqualTo(80),
                _imageUserPhoto.Height().EqualTo(80),

                _buttonPhoto.WithSameCenterX(_imageUserPhoto),
                _buttonPhoto.Width().EqualTo(80),
                _buttonPhoto.Height().EqualTo(80),
                _buttonPhoto.Below(_imageUserPhoto, -80)
                );
            View.AddConstraints(_passwordPattern.Below(_textUserPasswordRepeat, 2));
            View.AddConstraints(_passwordPattern.FullWidthOf(View, 25));

            View.AddConstraints(_buttonCreate.FullWidthOf(View, 25));
            View.AddConstraints(_buttonCreate.Below(_passwordPattern, 25));
            View.AddConstraints(_buttonCreate.Height().LessThanOrEqualTo(35));

            // very important to make scrolling work
            var bottomViewConstraint = _contentConteiner.Subviews.Last()
                                       .AtBottomOf(_contentConteiner).Minus(20);

            _contentConteiner.AddConstraints(bottomViewConstraint);

            //disable swipe
            CreateGestureRecognizer();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.White;

            downloadButton = UIButton.FromType(UIButtonType.RoundedRect);
            downloadButton.SetTitle("Start Downloading", UIControlState.Normal);
            downloadButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            downloadButton.BackgroundColor = UIColor.Blue;
            downloadButton.Layer.CornerRadius = 10f;
            downloadButton.TouchUpInside += DownloadButtonOnTouchUpInside;

            var customProgView = new UICustomProgressView();

            scrollView = new UIScrollView();
            scrollView.AddSubview(customProgView);
            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            scrollView.AddConstraints(new FluentLayout[]
            {
                customProgView.AtTopOf(scrollView),
                customProgView.AtLeftOf(scrollView),
                customProgView.WithSameWidth(scrollView),
                customProgView.Height().EqualTo(300)

            });

            #region For Loop
            for (var i = 0; i < TotalViews; i++)
            {
                var view = new UIProgressiveImageView();
                view.ImageView.ContentMode = UIViewContentMode.ScaleAspectFit;
                view.ImageView.BackgroundColor = UIColor.Gray;

                scrollView.AddSubview(view);
                scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

                if (i == 0)
                {
                    scrollView.AddConstraints(new []
                    {
                        view.AtTopOf(scrollView),
                        view.AtLeftOf(scrollView),
                        view.WithSameWidth(scrollView),
                        view.Height().EqualTo(ViewHeight),
                    });
                }

                else
                {
                    var previousView = scrollView.Subviews[i - 1];
                    scrollView.AddConstraints(new []
                    {
                        view.Below(previousView),
                        view.WithSameLeft(previousView),
                        view.WithSameWidth(previousView),
                        view.WithSameHeight(previousView)
                    });
                }
            }
            #endregion

            View.AddSubviews(downloadButton, scrollView);
            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(new[]
            {
                downloadButton.AtTopOf(View, UIApplication.SharedApplication.StatusBarFrame.Height),
                downloadButton.WithSameCenterX(View),
                downloadButton.WithSameWidth(View).Minus(20),
                downloadButton.Height().EqualTo(40),

                scrollView.Below(downloadButton),
                scrollView.AtLeftOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameBottom(View)
            });

            session = new HttpFilesDownloadSession(AppDelegate.BgSessionIdentifier);
            session.OnFileDownloadedSuccessfully += SessionOnFileDownloadedSuccessfully;
            session.OnFileDownloadFailed += SessionOnFileDownloadFailed;
            session.OnFileDownloadProgress += OnProgress;
        }
Example #21
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.FromRGB(204, 242, 255);

            var    border = new CALayer();
            nfloat width  = 2;

            border.BorderColor = UIColor.Black.CGColor;
            border.BorderWidth = width;

            ViewModel.Show();

            _contentConteiner = new UIView();
            _scrollView       = new UIScrollView();
            _scrollView.AddSubview(_contentConteiner);
            Add(_scrollView);

            var _BackBarButton = new UIBarButtonItem();

            _BackBarButton.Title             = "Back";
            NavigationItem.LeftBarButtonItem = _BackBarButton;

            _peopleConroller = new ABPeoplePickerNavigationController();
            _peopleConroller.SelectPerson2 += SelectPeople;
            _peopleConroller.Cancelled     += delegate
            {
                this.DismissModalViewController(true);
            };

            _labelTaskName = new UILabel();
            _contentConteiner.AddSubview(_labelTaskName);


            _labelError           = new UILabel();
            _labelError.Font      = _labelError.Font.WithSize(10);
            _labelError.TextColor = UIColor.Red;
            _contentConteiner.AddSubview(_labelError);

            _textEdit              = new UITextField();
            _textEdit.Placeholder  = "todo...";
            _textEdit.BorderStyle  = UITextBorderStyle.RoundedRect;
            _textEdit.ShouldReturn = (textField) =>
            {
                textField.ResignFirstResponder();
                return(true);
            };
            _contentConteiner.AddSubview(_textEdit);

            _textContactName              = new UITextField();
            _textContactName.Placeholder  = "add contact...";
            _textContactName.BorderStyle  = UITextBorderStyle.RoundedRect;
            _textContactName.ShouldReturn = (textField) =>
            {
                textField.ResignFirstResponder();
                return(true);
            };
            _contentConteiner.AddSubview(_textContactName);

            _textContactPhone               = new UITextField();
            _textContactPhone.Placeholder   = "add Phone...";
            _textContactPhone.KeyboardType  = UIKeyboardType.NamePhonePad;
            _textContactPhone.ReturnKeyType = UIReturnKeyType.Done;
            _textContactPhone.BorderStyle   = UITextBorderStyle.RoundedRect;
            _textContactPhone.ShouldReturn  = (textField) =>
            {
                textField.ResignFirstResponder();
                return(true);
            };
            _contentConteiner.AddSubview(_textContactPhone);

            _buttonSelectContact = new UIButton();
            _buttonSelectContact.BackgroundColor = UIColor.Blue;
            _buttonSelectContact.SetTitle("Add", UIControlState.Normal);
            _buttonSelectContact.Layer.CornerRadius = 5;
            _buttonSelectContact.Layer.BorderWidth  = 1;
            _buttonSelectContact.TouchUpInside     += delegate { PresentModalViewController(_peopleConroller, true); };
            _contentConteiner.AddSubview(_buttonSelectContact);

            _buttonCall = new UIButton();
            _buttonCall.BackgroundColor = UIColor.Blue;
            _buttonCall.SetTitle("Call", UIControlState.Normal);
            _buttonCall.Layer.CornerRadius = 5;
            _buttonCall.Layer.BorderWidth  = 1;
            _contentConteiner.AddSubview(_buttonCall);

            _swith    = new UISwitch();
            _swith.On = true;
            _contentConteiner.AddSubview(_swith);

            _buttonSave = new UIButton(UIButtonType.Custom);
            _buttonSave.BackgroundColor    = UIColor.Blue;
            _buttonSave.Layer.CornerRadius = 5;
            _buttonSave.Layer.BorderWidth  = 1;
            _buttonSave.SetTitle("Save", UIControlState.Normal);
            _contentConteiner.AddSubview(_buttonSave);

            _buttonDelete = new UIButton(UIButtonType.Custom);
            _buttonDelete.Layer.CornerRadius = 5;
            _buttonDelete.Layer.BorderWidth  = 1;
            _buttonDelete.BackgroundColor    = UIColor.Blue;
            _buttonDelete.SetTitle("Delete", UIControlState.Normal);
            _buttonDelete.TitleColor(UIControlState.Selected);
            _contentConteiner.AddSubview(_buttonDelete);

            var set = this.CreateBindingSet <ItemView, ItemViewModel>();

            set.Bind(_BackBarButton).To(vm => vm.BackToCommand);
            set.Bind(_labelTaskName).To(vm => vm.TaskName);
            set.Bind(_textEdit).To(vm => vm.TaskContent);
            set.Bind(_swith).To(vm => vm.TaskDone);
            set.Bind(_buttonSave).To(vm => vm.SaveItem);
            set.Bind(_buttonDelete).To(vm => vm.DeleteItem);
            set.Bind(_textContactName).To(vm => vm.ContactName);
            set.Bind(_textContactPhone).To(vm => vm.ContactPhone);
            set.Bind(_buttonCall).To(vm => vm.PhoneCallCommand);
            set.Bind(_labelError).To(vm => vm.Error);
            set.Apply();

            //conastraint
            _scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            _scrollView.AddConstraints(_contentConteiner.FullWidthOf(_scrollView));
            _scrollView.AddConstraints(_contentConteiner.FullHeightOf(_scrollView));

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(_scrollView.FullWidthOf(View));
            View.AddConstraints(_scrollView.FullHeightOf(View));
            View.AddConstraints(
                _contentConteiner.WithSameWidth(View),
                _contentConteiner.WithSameHeight(View).SetPriority(UILayoutPriority.DefaultLow)
                );

            _contentConteiner.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            _contentConteiner.AddConstraints(

                _labelError.AtTopOf(_contentConteiner),
                _labelError.WithSameWidth(_contentConteiner),
                _labelError.WithSameCenterX(_contentConteiner),
                _labelError.Height().EqualTo(20),

                _labelTaskName.WithSameCenterX(_contentConteiner),
                _labelTaskName.Below(_labelError, 25),
                _labelTaskName.WithSameWidth(_contentConteiner).Minus(130),
                _labelTaskName.Height().LessThanOrEqualTo(60),

                _textEdit.WithSameCenterX(_contentConteiner),
                _textEdit.Below(_labelTaskName, 20),
                _textEdit.WithSameWidth(_contentConteiner).Minus(25),
                _textEdit.Height().LessThanOrEqualTo(60),

                _textContactName.AtLeftOf(_contentConteiner, 25),
                _textContactName.Below(_textEdit, 20),
                _textContactName.WithSameWidth(_contentConteiner).Minus(130),
                _textContactName.Height().EqualTo(40),

                _textContactPhone.AtLeftOf(_contentConteiner, 25),
                _textContactPhone.Below(_textContactName, 20),
                _textContactPhone.WithSameWidth(_contentConteiner).Minus(130),
                _textContactPhone.Height().EqualTo(40),

                _buttonSelectContact.ToRightOf(_textContactName, 20),
                _buttonSelectContact.WithSameCenterY(_textContactName),
                _buttonSelectContact.Width().EqualTo(80),

                _swith.AtLeftOf(_contentConteiner, 25),
                _swith.Below(_textContactPhone, 20),

                _buttonCall.WithSameCenterY(_textContactPhone),
                _buttonCall.ToRightOf(_textContactPhone, 20),
                _buttonCall.Width().EqualTo(80),

                _buttonSave.AtLeftOf(_contentConteiner, 25),
                _buttonSave.Below(_swith, 40),
                _buttonSave.Width().EqualTo(80),
                _buttonSave.Height().LessThanOrEqualTo(35),

                _buttonDelete.WithSameCenterX(_buttonCall),
                _buttonDelete.Below(_swith, 40),
                _buttonDelete.Width().EqualTo(80),
                _buttonDelete.Height().LessThanOrEqualTo(35)

                );
            // very important to make scrolling work
            var bottomViewConstraint = _contentConteiner.Subviews.Last()
                                       .AtBottomOf(_contentConteiner).Minus(20);

            _contentConteiner.AddConstraints(bottomViewConstraint);
        }
Example #22
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var scrollView = new UIScrollView(View.Frame)
            {
                ShowsHorizontalScrollIndicator = false,
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight
            };

            // create a binding set for the appropriate view model
            var set = this.CreateBindingSet <MenuView, MenuViewModel>();

            var homeButton = new UIButton(new CGRect(0, 100, 320, 40));

            homeButton.SetTitle("Экран заказов", UIControlState.Normal);
            homeButton.BackgroundColor = UIColor.White;
            homeButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            set.Bind(homeButton).To(vm => vm.ShowHomeCommand);

            var statisticSellerButton = new UIButton(new CGRect(0, 100, 320, 40));

            statisticSellerButton.SetTitle("Статистика для продавца", UIControlState.Normal);
            statisticSellerButton.BackgroundColor = UIColor.White;
            statisticSellerButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            set.Bind(statisticSellerButton).To(vm => vm.ShowStatisticSellerCommand);

            //var statisticOwnerButton = new UIButton(new CGRect(0, 100, 320, 40));
            //statisticOwnerButton.SetTitle("Статистика для владельца", UIControlState.Normal);
            //statisticOwnerButton.BackgroundColor = UIColor.White;
            //statisticOwnerButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            //set.Bind(statisticOwnerButton).To(vm => vm.ShowStatisticOwnerCommand);

            var settingButton = new UIButton(new CGRect(0, 100, 320, 40));

            settingButton.SetTitle("Настройки", UIControlState.Normal);
            settingButton.BackgroundColor = UIColor.White;
            settingButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            set.Bind(settingButton).To(vm => vm.ShowHelpCommand);

            var exitButton = new UIButton(new CGRect(0, 100, 320, 40));

            exitButton.SetTitle("Выйти", UIControlState.Normal);
            exitButton.BackgroundColor = UIColor.White;
            exitButton.SetTitleColor(UIColor.Black, UIControlState.Normal);
            set.Bind(exitButton).To(vm => vm.ShowHelpCommand);

            set.Apply();

            Add(scrollView);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                scrollView.AtLeftOf(View),
                scrollView.AtTopOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameHeight(View));

            scrollView.Add(homeButton);
            scrollView.Add(statisticSellerButton);
            // scrollView.Add(statisticOwnerButton);
            scrollView.Add(settingButton);
            scrollView.Add(exitButton);

            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var constraints = scrollView.VerticalStackPanelConstraints(new Margins(20, 10, 20, 10, 5, 5), scrollView.Subviews);

            scrollView.AddConstraints(constraints);
        }
Example #23
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.White;

            scrollView = new UIScrollView();
            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;
            View.AddSubview(scrollView);

            View.AddConstraints(
                NSLayoutConstraint
                .FromVisualFormat(
                    "H:|[scrollView]|",
                    NSLayoutFormatOptions.AlignAllCenterX,
                    new NSDictionary(),
                    NSDictionary.FromObjectAndKey(scrollView, new NSString("scrollView"))
                    )
                );

            View.AddConstraints(
                NSLayoutConstraint
                .FromVisualFormat(
                    "V:|[scrollView]|",
                    NSLayoutFormatOptions.AlignAllCenterX,
                    new NSDictionary(),
                    NSDictionary.FromObjectAndKey(scrollView, new NSString("scrollView"))
                    )
                );

            stackView = new UIStackView();
            stackView.TranslatesAutoresizingMaskIntoConstraints = false;
            stackView.Axis      = UILayoutConstraintAxis.Vertical;
            stackView.Alignment = UIStackViewAlignment.Center;
            scrollView.AddSubview(stackView);

            scrollView.AddConstraints(
                NSLayoutConstraint
                .FromVisualFormat(
                    "H:|[stackView]|",
                    NSLayoutFormatOptions.AlignAllCenterX,
                    new NSDictionary(),
                    NSDictionary.FromObjectAndKey(stackView, new NSString("stackView"))
                    )
                );

            scrollView.AddConstraints(
                NSLayoutConstraint
                .FromVisualFormat(
                    "V:|[stackView]|",
                    NSLayoutFormatOptions.AlignAllCenterX,
                    new NSDictionary(),
                    NSDictionary.FromObjectAndKey(stackView, new NSString("stackView"))
                    )
                );


            ////This below constraint solves the alignment issues, see http://stackoverflow.com/questions/38074366/programmatic-layout-uistackview-alignment-doesnt-seem-to-work
            //scrollView.AddConstraints (
            //    NSLayoutConstraint
            //    .FromVisualFormat (
            //        "H:[stackView(==scrollView)]",
            //        NSLayoutFormatOptions.AlignAllCenterX,
            //        new NSDictionary (),
            //        NSDictionary.FromObjectsAndKeys (new NSObject [] { stackView, scrollView }, new NSString [] { new NSString ("stackView"), new NSString ("scrollView") })
            //    )
            //);

            for (var i = 0; i < 100; i++)
            {
                var vw = new UIButton(UIButtonType.System);
                vw.SetTitle("Button", UIControlState.Normal);
                stackView.AddArrangedSubview(vw);
            }
        }
Example #24
0
        /// <summary>
        /// Called after the controller�s <see cref="P:UIKit.UIViewController.View"/> is loaded into memory.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This method is called after <c>this</c>�<see cref="T:UIKit.UIViewController"/>'s <see cref="P:UIKit.UIViewController.View"/> and its entire view hierarchy have been loaded into memory. This method is called whether the <see cref="T:UIKit.UIView"/> was loaded from a .xib file or programmatically.
        /// </para>
        /// </remarks>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB(252, 80, 98);
            this.View.BackgroundColor = UIColor.FromRGB(232, 232, 232);;


            var scrollView = new UIScrollView(View.Frame)
            {
                ShowsHorizontalScrollIndicator = false,
                AutoresizingMask = UIViewAutoresizing.FlexibleHeight
            };


            var textEmail = new UITextField {
                Placeholder   = "Username"
                , BorderStyle = UITextBorderStyle.RoundedRect
            };
            var textPassword = new UITextField {
                Placeholder       = "Your password"
                , BorderStyle     = UITextBorderStyle.RoundedRect
                , SecureTextEntry = true
            };

            var loginButton = new UIButton(UIButtonType.RoundedRect);

            loginButton.SetTitle("Войти", UIControlState.Normal);
            loginButton.BackgroundColor = UIColor.FromRGB(252, 80, 98);;
            loginButton.SetTitleColor(UIColor.White, UIControlState.Normal);

            var array = new NSMutableArray();

            array.Add(new NSString("Продавец"));
            array.Add(new NSString("Управляющий"));

            //Add Data to our down picker outlet
            this._picker = new UIDownPicker(array)
            {
                BorderStyle = UITextBorderStyle.RoundedRect
            };
            _picker.Frame = this.View.Bounds;
            _picker.DownPicker.SetToolbarDoneButtonText("Выбрать");
            _picker.DownPicker.SetToolbarCancelButtonText("Отмена");
            //picker.DownPicker.SetArrowImage(UIImage.);
            //picker.DownPicker.SetToolbarStyle(UIBarStyle.Default);
            _picker.DownPicker.ShowArrowImage(true);
            _picker.DownPicker.SetPlaceholderWhileSelecting("Выберете роль...");
            _picker.DownPicker.SetPlaceholder("Выберете роль...");
            _picker.EditingDidEnd += Picker_EditingDidEnd;

            var set = this.CreateBindingSet <LoginView, LoginViewModel>();

            set.Bind(textEmail).To(vm => vm.Username);
            set.Bind(textPassword).To(vm => vm.Password);
            set.Bind(loginButton).To("Login");
            set.Apply();

            Add(scrollView);

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            View.AddConstraints(
                scrollView.AtLeftOf(View),
                scrollView.AtTopOf(View),
                scrollView.WithSameWidth(View),
                scrollView.WithSameHeight(View));

            scrollView.Add(_picker);
            scrollView.Add(textEmail);
            scrollView.Add(textPassword);
            scrollView.Add(loginButton);

            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            var constraints = scrollView.VerticalStackPanelConstraints(new Margins(20, 10, 20, 10, 5, 5), scrollView.Subviews);

            scrollView.AddConstraints(constraints);
        }
        public override void LoadView()
        {
            durationButton = new UIButton().Apply(Style.NavTimer.DurationButton);
            durationButton.SetTitle(DefaultDurationText, UIControlState.Normal);  // Dummy content to use for sizing of the label
            durationButton.SizeToFit();
            durationButton.TouchUpInside += OnDurationButtonTouchUpInside;
            NavigationItem.TitleView      = durationButton;

            var scrollView = new UIScrollView().Apply(Style.Screen);

            scrollView.Add(wrapper = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });

            wrapper.Add(startStopView = new StartStopView {
                TranslatesAutoresizingMaskIntoConstraints = false,
                StartTime = ViewModel.StartDate,
                StopTime  = ViewModel.StopDate,
            });
            startStopView.SelectedChanged += OnStartStopViewSelectedChanged;

            wrapper.Add(datePicker = new UIDatePicker {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Hidden = DatePickerHidden,
                Alpha  = 0,
            }.Apply(Style.EditTimeEntry.DatePicker));
            datePicker.ValueChanged += OnDatePickerValueChanged;

            wrapper.Add(projectButton = new ProjectClientTaskButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
            });
            projectButton.TouchUpInside += OnProjectButtonTouchUpInside;

            wrapper.Add(descriptionTextField = new TextField {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AttributedPlaceholder = new NSAttributedString(
                    "EditEntryDesciptionTimerHint".Tr(),
                    foregroundColor: Color.Gray
                    ),
                ShouldReturn = tf => tf.ResignFirstResponder(),
            }.Apply(Style.EditTimeEntry.DescriptionField));

            descriptionTextField.ShouldBeginEditing += (s) => {
                ForceDimissDatePicker();
                return(true);
            };
            descriptionTextField.ShouldEndEditing += s => {
                return(true);
            };

            wrapper.Add(tagsButton = new UIButton()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply(Style.EditTimeEntry.TagsButton));
            tagsButton.TouchUpInside += OnTagsButtonTouchUpInside;

            wrapper.Add(billableSwitch = new LabelSwitchView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Text = "EditEntryBillable".Tr(),
            }.Apply(Style.EditTimeEntry.BillableContainer));
            billableSwitch.Label.Apply(Style.EditTimeEntry.BillableLabel);

            wrapper.Add(deleteButton = new UIButton()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
            }.Apply(Style.EditTimeEntry.DeleteButton));
            deleteButton.SetTitle("EditEntryDelete".Tr(), UIControlState.Normal);
            deleteButton.TouchUpInside += OnDeleteButtonTouchUpInside;

            ResetWrapperConstraints();
            scrollView.AddConstraints(
                wrapper.AtTopOf(scrollView),
                wrapper.AtBottomOf(scrollView),
                wrapper.AtLeftOf(scrollView),
                wrapper.AtRightOf(scrollView),
                wrapper.WithSameWidth(scrollView),
                wrapper.Height().GreaterThanOrEqualTo().HeightOf(scrollView).Minus(64f),
                null
                );

            View = scrollView;
        }