Esempio 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;
            };
        }
Esempio 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();
        }
Esempio 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;
            };
        }
Esempio 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();
        }