Exemplo n.º 1
0
        public NewsSearchPage() : base()
        {
            InitializeComponent();
            Xamarin.Forms.PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(this, true);
            BindingContext = new SearchViewModel(1);
            this.SearchsListView.ItemSelected += async delegate
            {
                var search = SearchsListView.SelectedItem as Portable.Model.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;
            };
        }
Exemplo n.º 2
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            if (!hasInitialization)
            {
                BindingContext = new NewsViewModel(position);
                this.NewsListView.ItemSelected += async delegate
                {
                    var news = NewsListView.SelectedItem as News;
                    this.NewsListView.SelectedItem = null;
                    if (news == null)
                    {
                        return;
                    }

                    var newsDetails = new NewsDetailsPage(news);

                    await NavigationService.PushAsync(Navigation, newsDetails);
                };
                ViewModel.GetClientNewsAsync();

                hasInitialization = true;
            }
            UpdatePage();
        }
Exemplo n.º 3
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;
            };
        }
Exemplo n.º 4
0
        public NewsPage(int position = 0) : base()
        {
            InitializeComponent();
            Xamarin.Forms.PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(this, true);
            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;
            };
            ViewModel.GetClientNewsAsync();
        }