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

Commit

Permalink
因为要及时回收列表所以只能自己造后退栈
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiichiamane committed May 25, 2019
1 parent 6008870 commit 5c49ac5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions PixivFSUWP/Data/Backstack.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;

namespace PixivFSUWP.Data
{
public class Backstack : Stack<(Type, object)>
{
public static Backstack Default;

public bool CanBack
{
get => base.Count > 0;
}

public void Push(Type Page, object Parameter)
{
base.Push((Page, Parameter));
}

public void Back(Frame Frame)
{
if (!CanBack) throw new InvalidOperationException();
(var page, var param) = base.Pop();
Frame.Navigate(page, param);
}
}
}
1 change: 1 addition & 0 deletions PixivFSUWP/PixivFSUWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
<Compile Include="Controls\WaterfallListView.cs" />
<Compile Include="Converters\BookmarkHeartVisibilityConverter.cs" />
<Compile Include="Converters\MultiPageVisibilityConverter.cs" />
<Compile Include="Data\Backstack.cs" />
<Compile Include="Data\BigImageDetail.cs" />
<Compile Include="Data\BookmarkIllustsCollection.cs" />
<Compile Include="Data\CommentsCollection.cs" />
Expand Down

0 comments on commit 5c49ac5

Please sign in to comment.