Example #1
0
        public Detail()
        {
            InitializeComponent();

            HurriyetApi api          = new HurriyetApi();
            var         articlesJson = api.Get($"v1/articles/40518710");

            JsonModelMapper <ArticlesDetailModel> jsonModel = new JsonModelMapper <ArticlesDetailModel>();
            var article = jsonModel.GetItem(articlesJson);

            cvImages.ItemsSource = article.Files;
            lblTitle.Text        = article.Title;
        }
Example #2
0
        public Articles()
        {
            InitializeComponent();
            HurriyetApi api          = new HurriyetApi();
            var         articlesJson = api.Get("v1/articles");

            JsonModelMapper <ArticlesModel> jsonModel = new JsonModelMapper <ArticlesModel>();
            var articles = jsonModel.GetList(articlesJson);

            var items = articles
                        .Where(q => q.Files.Count > 0)
                        .Select(s => new ArticlesListViewModel
            {
                Id      = s.Id,
                FileUrl = s.Files.FirstOrDefault().FileUrl,
                Title   = s.Title,
                Path    = $"{s.Path.TagSubstring()} - {s.ModifiedDate.ToDate().ToString("dd.MM.yyyy HH:ss")}",
                Tags    = s.Tags.Count > 0 ? $"Tags : {s.Tags.StringListToString()}" : string.Empty
            }).Take(10).ToList();

            listView.ItemsSource   = items;
            listView.ItemSelected += ListView_ItemSelected;
        }