Skip to content

Instantly share code, notes, and snippets.

@gsedubun
Created May 21, 2018 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsedubun/d8eb6e7043900489688db819794082ed to your computer and use it in GitHub Desktop.
Save gsedubun/d8eb6e7043900489688db819794082ed to your computer and use it in GitHub Desktop.
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