Пример #1
0
        public DetailsView(MyProfile myProfile = null)
        {
            var name = new Label()
            {
                Text = myProfile.displayName,
                FontSize = 20,
                FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.Black
            };

            var where = new Label()
            {
                Text = myProfile.country,
                FontSize = 12,
                FontFamily = Device.OnPlatform("HelveticaNeue-Light", "sans-serif-light", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.FromHex("#666")
            };

            var bio = new Label()
            {
                Text = myProfile.biography.ToString().TruncateCharAtIndex(".",2),
                FontSize = 14,
                FontFamily = Device.OnPlatform("HelveticaNeue", "sans-serif", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.Black
            };

            var stack = new StackLayout()
            {
                Padding = new Thickness(20, 10),
                Children = {
					name,
					where,
					bio
				}
            };

            Content = stack;
        }
Пример #2
0
        private async Task ExecuteGetCPFeedCommand ()
        {
            if (IsBusy)
                return;

            IsBusy = true;

            GetCPFeedCommand.ChangeCanExecute();

            try
            {
                 myProfile = await cpFeed.GetMyProfile();
                 this.Avatar = myProfile.avatar;
                 this.DisplayName = myProfile.displayName;
                 Profile.Add(myProfile);
                //    avatar.Add(profiles.avatar);
                IsBusy = false;
            }
            catch (Exception ex)
            {

            }
        }
Пример #3
0
        public Profile(MyProfile myProfile = null)
        {
            Title = "Profile";
            NavigationPage.SetHasNavigationBar(this, true);
            BackgroundColor = Color.White;

            var backgroundImage = new Image()
            {
                BackgroundColor = Color.FromHex("#F57C00"),
                Aspect = Aspect.AspectFill,
                //IsOpaque = false,
                //Opacity = 0.8,
            };

            var shader = new BoxView()
            {
                Color = Color.FromHex("#F57C00").MultiplyAlpha(.5)
            };

            var face = new CircleImage
            {
                BorderColor = Color.White,
                BorderThickness = 2,
                HeightRequest = 100,
                WidthRequest = 100,
                Aspect = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                Source =
                    new UriImageSource { Uri = new Uri(myProfile.avatar), CacheValidity = TimeSpan.FromDays(15) },
            };

            var dome = new Image()
            {
                Aspect = Aspect.AspectFill,
                Source = new FileImageSource() { File = "dome.png" }
            };

            var twitterimage = new Image()
            {
                Source = new FileImageSource() { File = "twitter.png" }
            };

            var tapGestureTwitterRecognizer = new TapGestureRecognizer();
            tapGestureTwitterRecognizer.Tapped +=
                (sender, e) =>
                {
                    var profile = new WebViewPage("Twitter", myProfile.twitterName.TwitterUrl());
                    Navigation.PushAsync(profile);
                };
            twitterimage.GestureRecognizers.Add(tapGestureTwitterRecognizer);

            var linkedinimage = new Image()
            {
                Source = new FileImageSource() { File = "linkedin.png" }
            };

            var tapGestureLinkedInRecognizer = new TapGestureRecognizer();
            tapGestureLinkedInRecognizer.Tapped +=
                (sender, e) =>
                {
                    var profile = new WebViewPage("LinkedIn", myProfile.linkedInProfile);
                    Navigation.PushAsync(profile);
                };
            linkedinimage.GestureRecognizers.Add(tapGestureLinkedInRecognizer);

            var details = new DetailsView(myProfile);
            var slideshow = new ShowProfileDetailsView();

            RelativeLayout relativeLayout = new RelativeLayout()
            {
                HeightRequest = 100,
            };

            relativeLayout.Children.Add(
                backgroundImage,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * .35;
                })
            );

            relativeLayout.Children.Add(
                shader,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * .35;
                })
            );

            relativeLayout.Children.Add(
                dome,
                Constraint.Constant(-10),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35) - 50;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width + 10;
                }),
                Constraint.Constant(75)
            );

            relativeLayout.Children.Add(
                twitterimage,
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .05;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                })
            );

            relativeLayout.Children.Add(
                linkedinimage,
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .95 - (parent.Width * .15);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                })
            );

            relativeLayout.Children.Add(
                face,
                Constraint.RelativeToParent((parent) =>
                {
                    return ((parent.Width / 2) - (face.Width / 2));
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * .1;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .5;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .5;
                })
            );

            relativeLayout.Children.Add(
                details,
                Constraint.Constant(0),
                Constraint.RelativeToView(dome, (parent, view) =>
                {
                    return view.Y + view.Height + 10;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width;
                }),
                Constraint.Constant(200)
            );

            relativeLayout.Children.Add(
                    slideshow,
                    Constraint.Constant(0),
                    Constraint.RelativeToView(details, (parent, view) =>
                    {
                        return view.Y + view.Height;
                    }),
                    Constraint.RelativeToParent((parent) =>
                    {
                        return parent.Width;
                    }),
                    Constraint.RelativeToView(details, (parent, view) =>
                    {
                        var detailsbottomY = view.Y + view.Height;
                        return parent.Height - detailsbottomY;
                    })
                );

            face.SizeChanged += (sender, e) =>
            {
                relativeLayout.ForceLayout();
            };

            this.Content = relativeLayout;
        }
Пример #4
0
        public Profile(MyProfile myProfile = null)
        {
            Title = "Profile";
            NavigationPage.SetHasNavigationBar(this, true);
            BackgroundColor = Color.White;

            var backgroundImage = new Image()
            {
                BackgroundColor = Color.Red,
                Aspect = Aspect.AspectFill,
                IsOpaque = true,
                Opacity = 0.8,
            };

            var shader = new BoxView()
            {
                Color = Color.Black.MultiplyAlpha(.5)
            };

            var face = new CircleImage
            {
                BorderColor = Color.White,
                BorderThickness = 2,
                HeightRequest = 100,
                WidthRequest = 100,
                Aspect = Aspect.AspectFill,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Center,
                Source =
                    new UriImageSource { Uri = new Uri(myProfile.avatar), CacheValidity = TimeSpan.FromDays(30) },
            };

            var dome = new Image()
            {
                Aspect = Aspect.AspectFill,
                Source = new FileImageSource() { File = "dome.png" }
            };

            var chatimage = new Image()
            {
                Source = new FileImageSource() { File = "chat.png" }
            };

            var pindropimage = new Image()
            {
                Source = new FileImageSource() { File = "pindrop.png" }
            };

            var details = new DetailsView(myProfile);
            var slideshow = new ShowProfileDetailsView(myProfile);

            RelativeLayout relativeLayout = new RelativeLayout()
            {
                HeightRequest = 100,
            };

            relativeLayout.Children.Add(
                backgroundImage,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * .35;
                })
            );

            relativeLayout.Children.Add(
                shader,
                Constraint.Constant(0),
                Constraint.Constant(0),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * .35;
                })
            );

            relativeLayout.Children.Add(
                dome,
                Constraint.Constant(-10),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35) - 50;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width + 10;
                }),
                Constraint.Constant(75)
            );

            relativeLayout.Children.Add(
                chatimage,
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .05;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                })
            );

            relativeLayout.Children.Add(
                pindropimage,
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .95 - (parent.Width * .15);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return (parent.Height * .35);
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .15;
                })
            );

            relativeLayout.Children.Add(
                face,
                Constraint.RelativeToParent((parent) =>
                {
                    return ((parent.Width / 2) - (face.Width / 2));
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Height * .1;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .5;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width * .5;
                })
            );

            relativeLayout.Children.Add(
                details,
                Constraint.Constant(0),
                Constraint.RelativeToView(dome, (parent, view) =>
                {
                    return view.Y + view.Height + 10;
                }),
                Constraint.RelativeToParent((parent) =>
                {
                    return parent.Width;
                }),
                Constraint.Constant(200)
            );

            relativeLayout.Children.Add(
                    slideshow,
                    Constraint.Constant(0),
                    Constraint.RelativeToView(details, (parent, view) =>
                    {
                        return view.Y + view.Height;
                    }),
                    Constraint.RelativeToParent((parent) =>
                    {
                        return parent.Width;
                    }),
                    Constraint.RelativeToView(details, (parent, view) =>
                    {
                        var detailsbottomY = view.Y + view.Height;
                        return parent.Height - detailsbottomY;
                    })
                );

            face.SizeChanged += (sender, e) =>
            {
                relativeLayout.ForceLayout();
            };

            this.Content = relativeLayout;

        }
        public ShowProfileDetailsView(MyProfile myProfile = null)
        {
            HeightRequest = 200;

            var article = new Label()
            {
                Text = "Article",
                FontSize = 20,
                FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var articleCount = new Label()
            {
                Text = "4",
                FontSize = 14,
                FontFamily = Device.OnPlatform("HelveticaNeue", "sans-serif", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var stackArticle = new StackLayout()
            {
                Padding = new Thickness(20, 10),
                BackgroundColor = App.BrandColor,
                Children = {
					article,
					articleCount,
				}
            };
            var tapGestureRecognizer = new TapGestureRecognizer();
            tapGestureRecognizer.Tapped +=
                (sender, e) =>
                {
                    var authorArticles = new AuthorArticlePage("Article",AuthorDataType.Article);
                    Navigation.PushAsync(authorArticles);
                };
            stackArticle.GestureRecognizers.Add(tapGestureRecognizer);

            var techBlog = new Label()
            {
                Text = "Technical Blog",
                FontSize = 18,
                FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var techBlogCount = new Label()
            {
                Text = "40",
                FontSize = 14,
                FontFamily = Device.OnPlatform("HelveticaNeue", "sans-serif", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var stackBlog = new StackLayout()
            {
                Padding = new Thickness(20, 10),
                BackgroundColor = App.BrandColor,
                Children = {
					techBlog,
					techBlogCount,
				}
            };

            var tapGestureBlogMessageRecognizer = new TapGestureRecognizer();
            tapGestureBlogMessageRecognizer.Tapped +=
                (sender, e) =>
                {
                    var authorArticles = new AuthorArticlePage("Technical Blog",AuthorDataType.TechBlog);
                    Navigation.PushAsync(authorArticles);
                };

            stackBlog.GestureRecognizers.Add(tapGestureBlogMessageRecognizer);
            
            var message = new Label()
            {
                Text = "Message",
                FontSize = 20,
                FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var messageCount = new Label()
            {
                Text = "184",
                FontSize = 14,
                FontFamily = Device.OnPlatform("HelveticaNeue", "sans-serif", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var stackMessage = new StackLayout()
            {
                Padding = new Thickness(20, 10),
                BackgroundColor = App.BrandColor,
                Children = {
					message,
					messageCount,
				}
            };

            var tapGestureMessageRecognizer = new TapGestureRecognizer();
            tapGestureMessageRecognizer.Tapped +=
                (sender, e) =>
                {
                    var authorArticles = new AuthorArticlePage("Message",AuthorDataType.Message);
                    Navigation.PushAsync(authorArticles);
                };
            stackMessage.GestureRecognizers.Add(tapGestureMessageRecognizer);

            var tip = new Label()
            {
                Text = "Tip&Trick",
                FontSize = 20,
                FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var tipCount = new Label()
            {
                Text = "24",
                FontSize = 14,
                FontFamily = Device.OnPlatform("HelveticaNeue", "sans-serif", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var stackTip = new StackLayout()
            {
                Padding = new Thickness(20, 10),
                BackgroundColor = App.BrandColor,
                Children = {
					tip,
					tipCount,
				}
            };

            var tapGestureTipsRecognizer = new TapGestureRecognizer();
            tapGestureTipsRecognizer.Tapped +=
                (sender, e) =>
                {
                    var authorArticles = new AuthorArticlePage("Tips & Tricks",AuthorDataType.Tips);
                    Navigation.PushAsync(authorArticles);
                };

            stackTip.GestureRecognizers.Add(tapGestureTipsRecognizer);
            var comments = new Label()
            {
                Text = "Comment",
                FontSize = 20,
                FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var commentsCount = new Label()
            {
                Text = "84",
                FontSize = 14,
                FontFamily = Device.OnPlatform("HelveticaNeue", "sans-serif", null),
                XAlign = TextAlignment.Center,
                TextColor = Color.White
            };

            var stackComments = new StackLayout()
            {
                HeightRequest = 200,
                BackgroundColor = App.BrandColor,
                Padding = new Thickness(20, 10),
                Children = {
					comments,
					commentsCount,
				}
            };

            var tapGestureCommentsMessageRecognizer = new TapGestureRecognizer();
            tapGestureCommentsMessageRecognizer.Tapped +=
                (sender, e) =>
                {
                    var authorArticles = new AuthorArticlePage("Comments",AuthorDataType.Comments);
                    Navigation.PushAsync(authorArticles);
                };

            stackComments.GestureRecognizers.Add(tapGestureCommentsMessageRecognizer);

            //overall

            var stack = new StackLayout()
            {
                Padding = new Thickness(0, 0, 0, 10),
                Orientation = StackOrientation.Horizontal,

                Spacing = 10,
                Children = {
					stackArticle,
					stackMessage,
					stackTip,
					stackBlog,
					stackComments,
				}
            };

            Content = new ScrollView()
            {
                Content = stack,
                Orientation = ScrollOrientation.Horizontal
            };
        }