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);
        }
        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 #3
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 #4
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 #5
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 #6
0
        public override void LoadView()
        {
            base.LoadView();
            TitleScrollView = new UIScrollView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor                = UIColor.White,
                CanCancelContentTouches        = false,
                ShowsHorizontalScrollIndicator = false,
                Bounces  = false,
                Delegate = this
            };
            View.AddSubview(TitleScrollView);

            _bottomLine = new UIView {
                BackgroundColor = _tabColor
            };
            TitleScrollView.AddSubview(_bottomLine);

            _tabIndicator = new UIView {
                BackgroundColor = _tabColor
            };
            TitleScrollView.AddSubview(_tabIndicator);

            ContentScrollView = new UIScrollView
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                DelaysContentTouches           = false,
                ShowsHorizontalScrollIndicator = false,
                PagingEnabled = true,
                ScrollEnabled = true,
                Delegate      = this
            };
            View.AddSubview(ContentScrollView);

            View.AddConstraints(
                TitleScrollView.AtTopOf(View),
                TitleScrollView.AtLeftOf(View),
                TitleScrollView.AtRightOf(View),
                TitleScrollView.Height().EqualTo(_tabHeight),

                ContentScrollView.Below(TitleScrollView),
                ContentScrollView.WithSameWidth(TitleScrollView),
                ContentScrollView.AtBottomOf(View)
                );
        }
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();

            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 #8
0
        void InitScrollView()
        {
            ScrollView = new UIScrollView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false, Bounces = false
            };
            ContentView = new UIView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor = UIColor.Clear,
            };

            View.AddSubview(ScrollView);
            View.AddConstraints(
                ScrollView.AtLeftOf(View),
                ScrollView.AtRightOf(View),
                ScrollView.AtTopOf(View),
                ScrollView.AtBottomOf(View)
                );
            ScrollView.AddSubview(ContentView);
        }
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 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 #10
0
        private void AdjustConstraints()
        {
            View.RemoveConstraints(View.Constraints);

            View.AddConstraints(
                ShowOnBottom ?
                TitleScrollView.AtBottomOf(View) :
                TitleScrollView.AtTopOf(View),

                TitleScrollView.AtLeftOf(View),
                TitleScrollView.AtRightOf(View),
                TitleScrollView.Height().EqualTo(_tabHeight),

                ContentScrollView.WithSameWidth(TitleScrollView),

                ShowOnBottom ?
                ContentScrollView.Above(TitleScrollView) :
                ContentScrollView.Below(TitleScrollView),

                ShowOnBottom ?
                ContentScrollView.AtTopOf(View) :
                ContentScrollView.AtBottomOf(View)
                );
        }
Example #11
0
        protected override void InitializeObjects()
        {
            base.InitializeObjects();

            // Navigation bar
            var applicationLogo = new UIImageView(UIImage.FromBundle(@"Images/logo.png"));

            View.BackgroundColor  = UIColor.FromPatternImage(UIImage.FromFile(@"Images/main_background.png").Scale(View.Frame.Size));
            applicationLogo.Frame = new CGRect(10, 10, applicationLogo.Image.CGImage.Width, applicationLogo.Image.CGImage.Height);
            logoutButton          = RoundedButtonManager.ButtonInitiaziler("", UIImage.FromFile(@"Images/HomeView/ic_logout.png"));
            // Hide navigation bar
            NavigationController.SetNavigationBarHidden(true, false);

            var topView = new UIView();

            topView.AddIfNotNull(applicationLogo, logoutButton);
            topView.AddConstraints(
                applicationLogo.WithRelativeWidth(topView, 0.5f),
                applicationLogo.WithRelativeHeight(topView, 0.18f),
                applicationLogo.WithSameCenterX(topView),
                applicationLogo.WithSameCenterY(topView),

                logoutButton.AtTopOf(topView, 10),
                logoutButton.AtRightOf(topView),
                logoutButton.WithRelativeWidth(topView, 0.2f),
                logoutButton.WithRelativeHeight(topView, 0.4f)
                );

            // Central Board View
            boardScrollView          = CreateSliderBoard(true);
            buttonContainerView      = new UIView();
            roadInformationBoardView = new UIView();

            buttonContainerView.Frame = new CGRect(0, 0, (boardScrollView.Bounds.Width * EnvironmentInfo.GetValueForGettingWidthButtonsContainer),
                                                   (boardScrollView.Bounds.Height * 3));
            roadInformationBoardView.Frame = new CGRect((boardScrollView.Bounds.Width * EnvironmentInfo.GetValueForGettingWidthRoadInformationContainer),
                                                        EnvironmentInfo.GetValueForFirstSliderPositionY, (boardScrollView.Bounds.Width * 0.8), (boardScrollView.Bounds.Height * 2.5));
            boardScrollView.ContentSize = new CGSize((buttonContainerView.Bounds.Width + roadInformationBoardView.Bounds.Width), boardScrollView.Frame.Height);

            // Board View - Button Container
            profileButton    = RoundedButtonManager.ButtonInitiaziler("PROFILE", UIImage.FromFile(@"Images/HomeView/ic_home_profile.png"), UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_pointer.png"));
            payButton        = RoundedButtonManager.ButtonInitiaziler("PAY", UIImage.FromFile(@"Images/HomeView/ic_home_pay.png"), UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_pointer.png"));
            payHistoryButton = RoundedButtonManager.ButtonInitiaziler("PAY HISTORY", UIImage.FromFile(@"Images/HomeView/ic_home_pay_history.png"), UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_pointer.png"));

            buttonContainerView.AddIfNotNull(profileButton, payButton, payHistoryButton);
            buttonContainerView.AddConstraints(
                profileButton.AtTopOf(buttonContainerView, EnvironmentInfo.GetMarginTopButtonsContainer),
                profileButton.AtLeftOf(buttonContainerView),
                profileButton.WithRelativeWidth(buttonContainerView, 0.4f),
                profileButton.WithRelativeHeight(buttonContainerView, 0.6f),

                payHistoryButton.AtTopOf(buttonContainerView, EnvironmentInfo.GetMarginTopButtonsContainer),
                payHistoryButton.WithSameCenterX(buttonContainerView),
                payHistoryButton.WithRelativeWidth(buttonContainerView, 0.4f),
                payHistoryButton.WithRelativeHeight(buttonContainerView, 0.6f),

                payButton.AtTopOf(buttonContainerView, EnvironmentInfo.GetMarginTopButtonsContainer),
                payButton.AtRightOf(buttonContainerView),
                payButton.WithRelativeWidth(buttonContainerView, 0.4f),
                payButton.WithRelativeHeight(buttonContainerView, 0.6f)
                );

            // Board View - Road Information Container
            nextWaypointString = BoardFieldInitializer(UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_nearest_point.png"), "Nearest point in(ml):",
                                                       (roadInformationBoardView.Bounds.Width * EnvironmentInfo.GetDistanceBetweenLabelAndTextNearestPoint));
            geoLabelData = BoardFieldInitializer(UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_location.png"), "Geolocation:",
                                                 (roadInformationBoardView.Bounds.Width * EnvironmentInfo.GetDistanceBetweenLabelAndTextGeolocation));
            tollRoadString = BoardFieldInitializer(UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_tollroad.png"), "Tollroad:",
                                                   (roadInformationBoardView.Bounds.Width * EnvironmentInfo.GetDistanceBetweenLabelAndTextTollroad));
            statusLabel = BoardFieldInitializer(UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_status.png"), "Status:",
                                                (roadInformationBoardView.Bounds.Width * EnvironmentInfo.GetDistanceBetweenLabelAndTextStatus));

            roadInformationBoardView.AddIfNotNull(nextWaypointString, geoLabelData, tollRoadString, statusLabel);
            roadInformationBoardView.AddConstraints(
                nextWaypointString.AtTopOf(roadInformationBoardView, 10),
                nextWaypointString.AtLeftOf(roadInformationBoardView, 10),
                nextWaypointString.WithSameWidth(roadInformationBoardView),
                nextWaypointString.WithRelativeHeight(roadInformationBoardView, 0.2f),

                geoLabelData.Below(nextWaypointString),
                geoLabelData.AtLeftOf(roadInformationBoardView, 10),
                geoLabelData.WithSameWidth(roadInformationBoardView),
                geoLabelData.WithRelativeHeight(roadInformationBoardView, 0.2f),

                tollRoadString.Below(geoLabelData),
                tollRoadString.AtLeftOf(roadInformationBoardView, 10),
                tollRoadString.WithSameWidth(roadInformationBoardView),
                tollRoadString.WithRelativeHeight(roadInformationBoardView, 0.2f),

                statusLabel.Below(tollRoadString),
                statusLabel.AtLeftOf(roadInformationBoardView, 10),
                statusLabel.WithSameWidth(roadInformationBoardView),
                statusLabel.WithRelativeHeight(roadInformationBoardView, 0.2f)
                );

            boardScrollView.AddSubviews(buttonContainerView, roadInformationBoardView);
            boardScrollView.Scrolled += (sender, e) =>
            {
                Debug.WriteLine(((UIScrollView)sender).ContentOffset.X);
            };

            // Slider container
            var applicationBoard = new UIImageView(UIImage.FromBundle(@"Images/HomeView/home_board.png"));

            applicationBoard.Frame = new CGRect(10, 10, applicationBoard.Image.CGImage.Width, applicationBoard.Image.CGImage.Height);
            boardContainerView     = new UIView();
            boardContainerView.AddIfNotNull(applicationBoard, boardScrollView);
            boardContainerView.AddConstraints(
                applicationBoard.WithSameHeight(boardContainerView),
                applicationBoard.WithSameWidth(boardContainerView),
                applicationBoard.WithSameCenterX(boardContainerView),
                applicationBoard.WithSameCenterY(boardContainerView),

                boardScrollView.AtTopOf(boardContainerView, 10),
                boardScrollView.AtLeftOf(boardContainerView, 25),
                boardScrollView.AtRightOf(boardContainerView, 25),
                boardScrollView.WithRelativeHeight(boardContainerView, 0.55f)
                );

            // Bottom View
            trackingButton = RoundedButtonManager.ButtonInitiaziler(EnvironmentInfo.GetTrackingButtonDistanceBetweenTextAndImage);
            this.AddLinqBinding(ViewModel, vm => vm.TrackingCommand, (value) =>
            {
                trackingButton.BackgroundColor = UIColor.White;
                trackingButton.Alpha           = 0.7f;
                trackingButton.ButtonTextColor = UIColor.FromRGB(3, 117, 27);
            });

            //var callCenterLabel = new UILabel();
            //_callCentergButton = ButtonInitiaziler(null, UIImage.FromFile(@"Images/ic_home_support.png"));
            //_callCentergButton.ButtonText.TextColor = UIColor.LightGray;
            //_callCentergButton.ButtonBackgroundColor = null;
            //callCenterLabel.Text = "+(1)305 335 85 08";
            //callCenterLabel.TextColor = UIColor.LightGray;

            var bottomView = new UIView();

            bottomView.AddIfNotNull(trackingButton);
            bottomView.AddConstraints(
                trackingButton.AtTopOf(bottomView),
                trackingButton.AtLeftOf(bottomView, 20),
                trackingButton.AtRightOf(bottomView, 20),
                trackingButton.WithRelativeHeight(bottomView, EnvironmentInfo.GetTrackingButtonHeight),
                trackingButton.WithRelativeWidth(bottomView, EnvironmentInfo.GetTrackingButtonWidth)
                );

            // View Initialising
            View.AddIfNotNull(topView, boardContainerView, bottomView);
            View.AddConstraints(
                topView.AtTopOf(View),
                topView.AtLeftOf(View),
                topView.AtRightOf(View),
                topView.WithRelativeHeight(View, 0.2f),

                boardContainerView.Below(topView),
                boardContainerView.AtLeftOf(View, 15),
                boardContainerView.AtRightOf(View, 15),
                boardContainerView.WithRelativeHeight(View, 0.43f),

                bottomView.Below(boardContainerView),
                bottomView.WithSameCenterX(topView),
                bottomView.WithRelativeHeight(View, 0.27f),
                bottomView.AtBottomOf(View, 30)
                );
        }
Example #12
0
        public override void ViewDidLoad()
        {
            //base.ViewDidLoad();

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

            int     top = 120, left = 30;
            UIImage divider = UIImage.FromBundle("divider");

            MenuViewModel.MenuItems.Add(new MenuItem()
            {
                menu_title = Translator.GetText("gallery"),
                page_title = Translator.GetText("gallery"),
                url        = string.Empty
            });

            for (var i = 0; i < MenuViewModel.MenuItems.Count; i++)
            {
                MenuItem item = MenuViewModel.MenuItems[i];

                if (MvxEnumerableExtensions.ElementAt(menuIds, i) != null)
                {
                    var img       = UIImage.FromBundle(menuIds[i])?.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate);
                    var btnHeight = img?.Size.Height + 10 ?? 20;

                    var btn = new ButtonMenu(new CGRect(0, top, scrollView.Frame.Width, btnHeight), item, img)
                    {
                        ContentEdgeInsets = new UIEdgeInsets(0, left, 0, 0),
                        ContentMode       = UIViewContentMode.ScaleAspectFit
                    };

                    btn.TouchUpInside += OnMenuItemClick;

                    if (i == 0)
                    {
                        btn.Selected       = true;
                        lastSelectedButton = btn;
                    }

                    scrollView.Add(btn);

                    top += (int)btn.Frame.Height;

                    var leftSeparator = left + btn.TitleEdgeInsets.Left;
                    leftSeparator += btn.CurrentImage?.Size.Width ?? 0;

                    var separator = new UIImageView(new CGRect(leftSeparator, top, scrollView.Frame.Width - 160, 5))
                    {
                        Image = divider
                    };

                    scrollView.Add(separator);

                    top += (int)separator.Frame.Height + 10;
                }
            }

            Add(scrollView);


            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

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

            //scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            // var constraints = scrollView.VerticalStackPanelConstraints(new Margins(20, 120, 0, 10, 5, 5), scrollView.Subviews);
            //
            // scrollView.AddConstraints(constraints);
        }
Example #13
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);
        }
Example #14
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 #15
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title =
                new UILabel(new CGRect(60, 0, NavigationController.Toolbar.Frame.Width,
                                       NavigationController.Toolbar.Frame.Height))
            {
                TextColor       = Style.Header.TextColor,
                BackgroundColor = UIColor.Clear
            };

            GoBackButton = new UIButton(new CGRect(0, 0, 60, NavigationController.Toolbar.Frame.Height))
            {
                TintColor = Style.Header.TextColor,
                Hidden    = true
            };

            GoBackButton.TouchDown += OnClickGoBack;
            GoBackButton.SetImage(UIImage.FromBundle("back").ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate), UIControlState.Normal);

            GalleryView = new UIView()
            {
                Hidden = true
            };

            ChoosePicture       = UIButton.FromType(UIButtonType.RoundedRect);
            ChoosePicture.Frame = new CGRect(0, 0, View.Frame.Width / 2, 40);

            ChoosePicture.TintColor       = Style.Header.TextColor;
            ChoosePicture.BackgroundColor = UIColor.LightGray;

            ChoosePicture.SetTitle(Translator.GetText("choose_picture"), UIControlState.Normal);

            ChoosePicture.TouchDown += OnClickChoosePicture;

            TakePicture       = UIButton.FromType(UIButtonType.RoundedRect);
            TakePicture.Frame = new CGRect(View.Frame.Width / 2, 0, View.Frame.Width / 2, 40);

            TakePicture.TintColor       = Style.Header.TextColor;
            TakePicture.BackgroundColor = UIColor.LightGray;

            TakePicture.SetTitle(Translator.GetText("take_picture"), UIControlState.Normal);

            TakePicture.TouchDown += OnClickTakePicture;

            GalleryView.AddSubviews(ChoosePicture, TakePicture);

            NavigationController.NavigationBar.AddSubviews(GoBackButton);

            NavigationController.NavigationBar.TintColor    = Style.Header.TextColor;
            NavigationController.NavigationBar.BarTintColor = Style.Header.BackgroundColor;

            NavigationController.NavigationBar.AddSubviews(Title);

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

            WebView = new UIWebView
            {
                ScalesPageToFit = true
            };

            scrollView.AddSubviews(WebView, GalleryView);

            Add(scrollView);

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

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

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

                TakePicture.AtLeftOf(GalleryView),
                TakePicture.AtTopOf(GalleryView),

                ChoosePicture.AtRightOf(GalleryView),
                ChoosePicture.AtTopOf(GalleryView)
                );

            View.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();
            scrollView.SubviewsDoNotTranslateAutoresizingMaskIntoConstraints();

            MenuClickEvent.AddListener(this);

            var menuItem = MenuViewModel.MenuItems.First();

            OnMenuItemClick(menuItem.menu_title, menuItem.url, 0);

            _spinner = new Spinner(View);

            WebView.Delegate = new WebViewDelegate(_spinner, this);
        }