示例#1
0
        public MePageItem(String str, TapGestureRecognizer tap)
        {
            this.itemName      = str;
            this.HeightRequest = 50;
            this.WidthRequest  = (new Commservus_Mobile.LoginPage()).WidthRequest;

            tempIcon = new RoundedBoxView
            {
                HeightRequest   = 30,
                WidthRequest    = 30,
                BackgroundColor = Util.GREY,
                CornerRadius    = 15,
            };
            AbsoluteLayout.SetLayoutFlags(tempIcon, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(tempIcon,
                                           new Rectangle(.05f, .5f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            Label title = new Label
            {
                Text      = this.itemName,
                FontSize  = 14,
                TextColor = Util.GREEN,
                HorizontalTextAlignment = TextAlignment.Start,
                WidthRequest            = 250,
            };

            AbsoluteLayout.SetLayoutFlags(title, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(title,
                                           new Rectangle(.5f, .5f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            RoundedBoxView viewBtnBackground = new RoundedBoxView
            {
                CornerRadius    = 10,
                BackgroundColor = Util.ORANGE,
            };

            AbsoluteLayout.SetLayoutFlags(viewBtnBackground, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(viewBtnBackground,
                                           new Rectangle(.95f, .5f, .15f, .5f));

            Label viewLbl = new Label
            {
                Text           = "View",
                TextColor      = Util.LIGHTGREY,
                FontSize       = 12,
                FontAttributes = FontAttributes.Bold,
            };

            AbsoluteLayout.SetLayoutFlags(viewLbl, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(viewLbl,
                                           new Rectangle(.91, .5f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            viewLbl.GestureRecognizers.Add(tap);



            this.Children.Add(this.tempIcon);
            this.Children.Add(title);
            this.Children.Add(viewBtnBackground);
            this.Children.Add(viewLbl);
        }
示例#2
0
        public MePage_()
        {
            Title           = "Me";
            BackgroundColor = Util.GREY;

            //first section
            var myAccountTap = new TapGestureRecognizer();

            myAccountTap.Tapped += (sender, e) =>
            {
            };
            MePageItem myAccountItem = new MePageItem("Joe Smoe", myAccountTap);
            //myAccountItem.GestureRecognizers.Add(myAccountTap);
            var mySocialGroupTap = new TapGestureRecognizer();

            mySocialGroupTap.Tapped += (sender, e) =>
            {
                try
                {
                    Navigation.PushAsync(new Commservus_Mobile.AccountPage()
                    {
                    });
                }
                catch (Exception ex)
                {
                }
            };

            MePageItem mySocialGroupsItem = new MePageItem("My Test Item", mySocialGroupTap);
            var        myDataProfileTap   = new TapGestureRecognizer();

            myDataProfileTap.Tapped += (sender, e) =>
            {
                Navigation.PushAsync(new Commservus_Mobile.AccountPage()
                {
                });
            };

            mySocialGroupsItem.GestureRecognizers.Add(myDataProfileTap);

            MePageItem myDataProfilesItem = new MePageItem("My Other Test Item", myDataProfileTap);

            StackLayout upperStackLayout = new StackLayout
            {
                Spacing         = 5,
                BackgroundColor = Color.Transparent,
                Children        =
                {
                    myAccountItem,
                    mySocialGroupsItem,
                    myDataProfilesItem,
                },
            };

            AbsoluteLayout.SetLayoutFlags(upperStackLayout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(upperStackLayout,
                                           new Rectangle(0f, 0f, 1f, 1f));

            RoundedBoxView upperBackground = new RoundedBoxView()
            {
                BackgroundColor = Util.LIGHTGREY,
                CornerRadius    = 10,
            };

            AbsoluteLayout.SetLayoutFlags(upperBackground, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(upperBackground,
                                           new Rectangle(0f, 0f, 1f, 1f));

            AbsoluteLayout upperLayout = new AbsoluteLayout
            {
                BackgroundColor = Color.Transparent,
                Children        =
                {
                    upperBackground,
                    upperStackLayout,
                },
            };

            AbsoluteLayout.SetLayoutFlags(upperLayout, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(upperLayout,
                                           new Rectangle(.1f, .5f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));

            //second section
            var upgradeTap = new TapGestureRecognizer();

            upgradeTap.Tapped += (sender, e) =>
            {
                //App.Current.MainPage = new PCT_Xamarin.
            };
            MePageItem upgradeItem = new MePageItem("Upgrade to Premium", upgradeTap);
            var        termsTap    = new TapGestureRecognizer();

            termsTap.Tapped += (sender, e) =>
            {
                //App.Current.MainPage = new PCT_Xamarin.
            };
            MePageItem termsItem    = new MePageItem("Terms & Agreement", termsTap);
            var        contactUsTap = new TapGestureRecognizer();

            contactUsTap.Tapped += (sender, e) =>
            {
            };
            MePageItem contactUsItem = new MePageItem("Contact Us", contactUsTap);

            RoundedBoxView lowerBackground = new RoundedBoxView
            {
                BackgroundColor = Util.LIGHTGREY,
                CornerRadius    = 10,
            };

            AbsoluteLayout.SetLayoutFlags(lowerBackground, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(lowerBackground,
                                           new Rectangle(0f, 0f, 1f, 1f));

            StackLayout lowerStack = new StackLayout
            {
                BackgroundColor = Color.Transparent,
                Children        =
                {
                    upgradeItem,
                    termsItem,
                    contactUsItem,
                },
            };

            AbsoluteLayout.SetLayoutFlags(lowerStack, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(lowerStack,
                                           new Rectangle(0f, 0f, 1f, 1f));

            AbsoluteLayout lowerLayout = new AbsoluteLayout
            {
                BackgroundColor = Color.Transparent,
                Children        =
                {
                    lowerBackground,
                    lowerStack,
                },
            };

            var logoutTap = new TapGestureRecognizer();

            logoutTap.Tapped += (sender, e) =>
            {
                Util.logout();

                App.PAGE             = "MAIN";
                App.Current.MainPage = new Commservus_Mobile.MainPage();
            };


            RoundedBoxView logoutOuter = new RoundedBoxView
            {
                BackgroundColor = Util.LIGHTGREY,
                CornerRadius    = 10,
            };

            logoutOuter.GestureRecognizers.Add(logoutTap);

            AbsoluteLayout.SetLayoutFlags(logoutOuter, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(logoutOuter,
                                           new Rectangle(0f, 0f, 1f, 1f));

            RoundedBoxView logoutInner = new RoundedBoxView
            {
                BackgroundColor = Util.LIGHTGREY,
                CornerRadius    = 10,
            };

            AbsoluteLayout.SetLayoutFlags(logoutOuter, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(logoutOuter,
                                           new Rectangle(0f, 0f, .99f, .99f));

            logoutInner.GestureRecognizers.Add(logoutTap);

            Label logoutLbl = new Label
            {
                Text      = "Log Out",
                FontSize  = 16,
                TextColor = Color.Red,
            };

            AbsoluteLayout.SetLayoutFlags(logoutLbl, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(logoutLbl,
                                           new Rectangle(.5f, .5f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));


            logoutLbl.GestureRecognizers.Add(logoutTap);

            AbsoluteLayout logoutLayout = new AbsoluteLayout
            {
                BackgroundColor = Color.Transparent,
                Children        =
                {
                    logoutOuter,
                    logoutLbl,
                }
            };


            StackLayout contentLayout = new StackLayout
            {
                Spacing  = 20,
                Children =
                {
                    upperLayout,
                    lowerLayout,
                    logoutLayout,
                },
            };

            AbsoluteLayout.SetLayoutFlags(contentLayout, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(contentLayout,
                                           new Rectangle(0f, .48f, 1f, .84f));


            //footer
            Footer footer = new Footer();

            footer.meLbl.TextColor = Util.GREEN;
            AbsoluteLayout.SetLayoutFlags(footer, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(footer, new Rectangle(0f, 1f, 1f, .1f));


            this.layout = new AbsoluteLayout
            {
                Children =
                {
                    contentLayout,
                    footer,
                },
            };

            this.Content = this.layout;
        }
示例#3
0
        public ContactItem()
        {
            //BackgroundColor = Utilities.GREEN;

            BoxView inner = new BoxView
            {
                BackgroundColor = Color.White,
            };

            AbsoluteLayout.SetLayoutFlags(inner, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(inner,
                                           new Rectangle(.01f, .01f, 1f, .98f));


            this.contactTap           = new TapGestureRecognizer();
            this.contactTap.Tapped   += (s, e) => {
                //App.Current.MainPage = new PCT_Xamarin.UserAccount(this.associatedUser);
            };
            this.permGroupTap         = new TapGestureRecognizer();
            this.permGroupTap.Tapped += (s, e) => {
                //App.Current.MainPage = ***PERM GROUP PAGE***
            };

            RoundedBoxView tempPic = new RoundedBoxView
            {
                BackgroundColor = Util.GREY,
                CornerRadius    = 35 / 2,
            };

            AbsoluteLayout.SetLayoutFlags(tempPic, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(tempPic,
                                           new Rectangle(.05f, 0f, 35, 35));
            tempPic.GestureRecognizers.Add(this.contactTap);

            string nameString = "Test Name";

            if (nameString.Length > 22)
            {
                nameString = nameString.Substring(0, 22) + "...";
            }


            this.name = new Label
            {
                Text     = nameString,
                FontSize = 18,
                HorizontalTextAlignment = TextAlignment.Start,
                TextColor    = Util.GREEN,
                WidthRequest = 250,
            };
            AbsoluteLayout.SetLayoutFlags(this.name, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(this.name, new Rectangle(.5f, .5f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            this.name.GestureRecognizers.Add(this.contactTap);

            this.permGroup = new Label
            {
                Text      = "Dog",
                TextColor = Util.GREY,
                FontSize  = 14,
                HorizontalTextAlignment = TextAlignment.Center,
            };
            AbsoluteLayout.SetLayoutFlags(this.permGroup, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(this.permGroup, new Rectangle(.9f, .5f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            this.permGroup.GestureRecognizers.Add(this.permGroupTap);

            this.Children.Add(inner);
            this.Children.Add(tempPic);
            this.Children.Add(this.name);
            this.Children.Add(this.permGroup);
        }