Skip to content

Commit

Permalink
added old "last played" sorting as new sorting option (HearthSim#1248,
Browse files Browse the repository at this point in the history
  • Loading branch information
Epix37 committed Aug 17, 2015
1 parent 09e77c0 commit 4c98570
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ public void Sort()
case "Last Played":
view.SortDescriptions.Add(new SortDescription("LastPlayed", ListSortDirection.Descending));
break;
case "Last Played (new first)":
view.SortDescriptions.Add(new SortDescription("LastPlayedNewFirst", ListSortDirection.Descending));
break;
case "Last Edited":
view.SortDescriptions.Add(new SortDescription("LastEdited", ListSortDirection.Descending));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ public DateTime LastPlayed
get { return Deck.LastPlayed; }
}

public DateTime LastPlayedNewFirst
{
get { return Deck.LastPlayedNewFirst; }
}

public double WinPercent
{
get { return Deck.WinPercent; }
Expand Down
6 changes: 4 additions & 2 deletions Hearthstone Deck Tracker/FlyoutControls/SortFilterDecks.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
Margin="0,5,0,0">
<system:String>Name</system:String>
<system:String>Last Played</system:String>
<system:String>Last Played (new first)</system:String>
<system:String>Last Edited</system:String>
<system:String>Tag</system:String>
<system:String>Win Rate</system:String>
Expand All @@ -30,8 +31,9 @@
<ComboBox Name="ComboboxDeckSortingArena" SelectionChanged="SelectorArena_OnSelectionChanged"
Margin="0,5,0,0">
<system:String>Name</system:String>
<system:String>Last Played</system:String>
<system:String>Last Edited</system:String>
<system:String>Last Played</system:String>
<system:String>Last Played (new first)</system:String>
<system:String>Last Edited</system:String>
<system:String>Tag</system:String>
<system:String>Win Rate</system:String>
</ComboBox>
Expand Down
10 changes: 10 additions & 0 deletions Hearthstone Deck Tracker/Hearthstone/Deck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,16 @@ public DateTime LastPlayed
}
}

[XmlIgnore]
public DateTime LastPlayedNewFirst
{
get
{
var games = DeckStats.Games;
return !games.Any() ? LastEdited : games.OrderByDescending(g => g.StartTime).First().StartTime;
}
}

[XmlIgnore]
public string GetClass
{
Expand Down

0 comments on commit 4c98570

Please sign in to comment.