Ejemplo n.º 1
0
        public AuthorArticlePage (string title,AuthorDataType authorDataType)
        {
            Title = title;
            NavigationPage.SetHasNavigationBar(this, true);
            NavigationPage.SetHasBackButton(this,true);
            NavigationPage.SetBackButtonTitle(this,"Profile");
            authorDataViewModel = new AuthorDataViewModel(authorDataType);
            authorDataViewModel.GetAuthorDataCommand.Execute(null);
            var activityIndicator = new ActivityIndicator
            {
                Color = Color.Gray,
            };
            activityIndicator.SetBinding(IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            var vetlist = new ListView
            {
                HasUnevenRows = false,
                ItemTemplate = new DataTemplate(typeof(CPListCell)),
                ItemsSource = authorDataViewModel.AutorItems,
                BackgroundColor = Color.White,
                RowHeight = 120,
            };

            //vetlist.SetBinding<ArticlePageViewModel>();
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { vetlist }
            };

            vetlist.ItemSelected += (sender, e) =>
            {
                var selectedObject = e.SelectedItem as CPMobile.Models.Item;

                var WebViewPage = new WebViewPage(title, selectedObject.websiteLink.HttpUrlFix());
                Navigation.PushAsync(WebViewPage);
            };
        }
Ejemplo n.º 2
0
        public ForumDetailListPage(string name,int forumId)
        {
            Title = name;
            NavigationPage.SetHasNavigationBar(this, true);
            BindingContext=forumViewModel = new ForumDetailsViewModel(forumId);
            forumViewModel.GetForumListCommand.Execute(null);

            var activityIndicator = new ActivityIndicator
            {
                Color = Color.Gray,
            };
            activityIndicator.SetBinding(IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            var vetlist = new ListView
            {
                HasUnevenRows = false,
                ItemTemplate = new DataTemplate(typeof(CPListCell)),
                ItemsSource = forumViewModel.ForumList,
                BackgroundColor = Color.White,
                RowHeight = 120,
            };

            //vetlist.SetBinding<ArticlePageViewModel>();
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { vetlist }
            };

            vetlist.ItemSelected += (sender, e) =>
            {
                var selectedObject = e.SelectedItem as CPMobile.Models.Item;

                var WebViewPage = new WebViewPage(name,  selectedObject.websiteLink);
                Navigation.PushAsync(WebViewPage);
            };
        }
Ejemplo n.º 3
0
        public ArticleListPage()
        {
           articleViewModel = new ArticleViewModel();
           articleViewModel.GetCPFeedCommand.Execute(null);
            var activityIndicator = new ActivityIndicator
            {
                Color = Color.White,
            };
            activityIndicator.SetBinding(IsVisibleProperty, "IsBusy");
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy");
            var vetlist = new ListView
            {
                HasUnevenRows = false,
                ItemTemplate = new DataTemplate(typeof(CPListCell)),
                ItemsSource = articleViewModel.Articles,
                BackgroundColor = Color.White,
                RowHeight=120,
            };
           
            //vetlist.SetBinding<ArticlePageViewModel>();
             Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { vetlist  }
            };

             vetlist.ItemSelected += (sender, e) =>
             {
                 var selectedObject = e.SelectedItem as CPMobile.Models.Item;

                 var WebViewPage = new WebViewPage("General Articles",string.Format("http:{0}",selectedObject.websiteLink));
                 Navigation.PushAsync(WebViewPage);
                // Navigation.PushAsync( );
             };
           
        }
Ejemplo n.º 4
0
        public FavoriteListPage()
        {
            Title = "Favorite";
            NavigationPage.SetHasNavigationBar(this, true);
            BindingContext=favViewModel = new FavoriteListViewModel();
            favViewModel.GetFavoriteListCommand.Execute(null);
            var searchBar = new SearchBar
            {
                Placeholder = "Search Forum ",
                BackgroundColor = Color.White,
                CancelButtonColor = App.BrandColor,
            };
            var vetlist = new ListView
            {
                HasUnevenRows = false,
                ItemTemplate = new DataTemplate(typeof(CustomListStyle)),
                ItemsSource = favViewModel.FavList,
                BackgroundColor = Color.White,
                RowHeight = 50,
            };

            //vetlist.SetBinding<ArticlePageViewModel>();
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
                BackgroundColor = Color.White,
                Children = { searchBar, vetlist }
            };

            vetlist.ItemSelected += (sender, e) =>
            {
                var selectedObject = e.SelectedItem as CPMobile.Models.Item;

                var favPage = new WebViewPage(selectedObject.title, selectedObject.websiteLink.HttpUrlFix());
                Navigation.PushAsync(favPage);
            };
        }
Ejemplo n.º 5
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;
        }