Created
May 21, 2018 14:45
-
-
Save gsedubun/d8eb6e7043900489688db819794082ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ViewAViewModel : BindableBase | |
{ | |
private NewsService NewsService; | |
private NewsAnnouncement newsAnnouncement; | |
public NewsAnnouncement NewsAnnouncement | |
{ | |
get { return newsAnnouncement; } | |
set | |
{ | |
SetProperty(ref newsAnnouncement, value); | |
} | |
} | |
private AnnouncementDetail _announcement; | |
public AnnouncementDetail Announcement | |
{ | |
get { return _announcement; } | |
set | |
{ | |
SetProperty(ref _announcement, value); | |
} | |
} | |
public DelegateCommand<long?> SelectArticle { get; set; } | |
public ViewAViewModel() | |
{ | |
this.NewsService = new NewsService("http://www.idx.co.id"); | |
this.NewsAnnouncement = NewsService.NewsAnnouncements(Locale.IdId, 20); | |
SelectArticle = new DelegateCommand<long?>(Select, CanSelect); | |
} | |
private bool CanSelect(long? arg) | |
{ | |
return true; | |
} | |
private void Select(long? itemid) | |
{ | |
Debug.WriteLine(itemid + "==============>"); | |
if (itemid.HasValue) | |
{ | |
Announcement = NewsService.Details(itemid.Value);// | |
Item singlnews = NewsAnnouncement.Items.SingleOrDefault(d => d.Id == itemid); | |
} | |
if (Announcement == null) | |
{ | |
MessageBox.Show("Article not found."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment