public NewsSearchPage() : base()
        {
            InitializeComponent();
            BindingContext = new SearchViewModel(1);
            this.SearchsListView.ItemSelected += async delegate
            {
                var search = SearchsListView.SelectedItem as Search;
                if (search == null)
                {
                    return;
                }

                var news = new News()
                {
                    IsHot        = false,
                    IsRecommend  = false,
                    TopicIcon    = "",
                    TopicId      = 0,
                    Body         = "",
                    CommentCount = search.CommentTimes,
                    Summary      = search.Content,
                    DiggCount    = search.VoteTimes,
                    Id           = int.Parse(search.Id),
                    DateAdded    = search.PublishTime,
                    Title        = search.Title.Replace("<strong>", "").Replace("</strong>", ""),
                    ViewCount    = search.ViewTimes
                };
                var articlesDetails = new NewsDetailsPage(news);

                await NavigationService.PushAsync(Navigation, articlesDetails);

                this.SearchsListView.SelectedItem = null;
            };
        }
Example #2
0
        public NewsPage(int position = 0) : base()
        {
            InitializeComponent();
            BindingContext = new NewsViewModel(position);
            this.NewsListView.ItemSelected += async delegate
            {
                var news = NewsListView.SelectedItem as News;
                if (news == null)
                {
                    return;
                }

                var newsDetails = new NewsDetailsPage(news);

                await NavigationService.PushAsync(Navigation, newsDetails);

                this.NewsListView.SelectedItem = null;
            };
        }