Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
让瀑布流项目实现INotifyPropertyChanged便于更新列表
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiichiamane committed May 25, 2019
1 parent 7dd2e55 commit 5649e4d
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions PixivFSUWP/ViewModels/WaterfallItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,47 @@
using PixivFSUWP.Data;
using Windows.UI.Xaml.Media.Imaging;
using System.IO;
using System.ComponentModel;

namespace PixivFSUWP.ViewModels
{
public class WaterfallItemViewModel
public class WaterfallItemViewModel : INotifyPropertyChanged
{
public int ItemId { get; private set; }
public string Title { get; set; }
public string Author { get; set; }
public string ImageUri { get; set; }
public int Stars { get; set; }

private int _stars;
public int Stars
{
get => _stars;
set
{
_stars = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Stars)));
}
}

public int Pages { get; set; }
public bool IsBookmarked { get; set; }

private bool _isbookmarked;
public bool IsBookmarked
{
get => _isbookmarked;
set
{
_isbookmarked = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsBookmarked)));
}
}

public BitmapImage ImageSource { get; set; }
public int Width { get; set; }
public int Height { get; set; }

public event PropertyChangedEventHandler PropertyChanged;

public async Task LoadImageAsync()
{
ImageSource = await Data.OverAll.LoadImageAsync(ImageUri);
Expand Down

0 comments on commit 5649e4d

Please sign in to comment.