Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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