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

Commit

Permalink
初步完成Item和ViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiichiamane committed Apr 12, 2019
1 parent 191aa4e commit 558d295
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
17 changes: 17 additions & 0 deletions PixivFSUWP/Data/WaterfallItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PixivFSUWP.Data
{
public class WaterfallItem
{
public int Id { get; set; }
public string Title { get; set; }
public string Author { get; set; }
public string ImageUri { get; set; }
public int Stars { get; set; }
}
}
2 changes: 2 additions & 0 deletions PixivFSUWP/PixivFSUWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,15 @@
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Data\OverAll.cs" />
<Compile Include="Data\WaterfallItem.cs" />
<Compile Include="LoginPage.xaml.cs">
<DependentUpon>LoginPage.xaml</DependentUpon>
</Compile>
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\WaterfallItemViewModel.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
Expand Down
30 changes: 30 additions & 0 deletions PixivFSUWP/ViewModels/WaterfallItemViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PixivFSUWP.Data;

namespace PixivFSUWP.ViewModels
{
public class WaterfallItemViewModel
{
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; }

public string GetStarsString() => Stars.ToString();

public static WaterfallItemViewModel FromItem(WaterfallItem Item)
=> new WaterfallItemViewModel()
{
ItemId = Item.Id,
Title = Item.Title,
Author = Item.Author,
ImageUri = Item.ImageUri,
Stars = Item.Stars
};
}
}

0 comments on commit 558d295

Please sign in to comment.