Skip to content

Commit

Permalink
Kekw
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmicPredator committed Nov 28, 2024
1 parent f628269 commit 10cb4eb
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 12 deletions.
4 changes: 2 additions & 2 deletions AniMoe.App/Controls/ListControls/AnimeListFilterDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
VerticalAlignment="Center"
Text="{x:Bind EpisodeChapterMin}" />
<ctktCont:RangeSelector
x:Name="EpChapterComboBox"
x:Name="EpChapterSlider"
Grid.Column="1"
HorizontalAlignment="Stretch" />
<TextBlock
Expand Down Expand Up @@ -232,7 +232,7 @@
VerticalAlignment="Center"
Text="{x:Bind DurationVolumeMin}" />
<ctktCont:RangeSelector
x:Name="DurationVolComboBox"
x:Name="DurationVolumeSlider"
Grid.Column="1"
HorizontalAlignment="Stretch" />
<TextBlock
Expand Down
26 changes: 16 additions & 10 deletions AniMoe.App/Controls/ListControls/AnimeListFilterDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ public sealed partial class AnimeListFilterDialog : ContentDialog
public List<string> SelectedNotInTags = new();
public int? SelectedStartYear;
public int? SelectedEndYear;
public int? SelectedChapterMin;
public int? SelectedChapterMax;
public int? SelectedEpChapterMin;
public int? SelectedEpChapterMax;
public int? SelectedDurationVolumeMin;
public int? SelectedDurationVolumeMax;

private MainViewModel MainViewModel = Ioc.Default.GetRequiredService<MainViewModel>();

Expand Down Expand Up @@ -151,8 +153,10 @@ public void ClearFilters()
SelectedStatus = null;
SelectedMediaSource = null;
SelectedSeason = null;
SelectedChapterMin = null;
SelectedChapterMax = null;
SelectedEpChapterMin = null;
SelectedEpChapterMax = null;
SelectedDurationVolumeMin = null;
SelectedDurationVolumeMax = null;

SelectedGenres = new();
SelectedTags = new();
Expand All @@ -177,8 +181,10 @@ private void ResetFilterControls()
SeasonComboBox.SelectedIndex = -1;
YearRangeComboBox.RangeStart = YearRangeStart;
YearRangeComboBox.RangeEnd = YearRangeEnd;
EpChapterComboBox.RangeStart = EpisodeChapterMin;
EpChapterComboBox.RangeEnd = EpisodeChapterMax;
EpChapterSlider.RangeStart = EpisodeChapterMin;
EpChapterSlider.RangeEnd = EpisodeChapterMax;
DurationVolumeSlider.RangeStart = DurationVolumeMin;
DurationVolumeSlider.RangeEnd = DurationVolumeMax;
}

private void LoadDataFromControls()
Expand All @@ -189,12 +195,12 @@ private void LoadDataFromControls()
SelectedStatus = StatusComboBox.SelectedValue as MediaStatus?;
SelectedMediaSource = SourceMaterialComboBox.SelectedValue as MediaSource?;
SelectedSeason = SeasonComboBox.SelectedValue as MediaSeason?;
//SelectedStartYear =
// (int)YearRangeComboBox.RangeStart == YearRangeStart ? null : (int)YearRangeComboBox.RangeStart;
//SelectedEndYear =
// (int)YearRangeComboBox.RangeEnd == YearRangeEnd ? null : (int)YearRangeComboBox.RangeEnd;
SelectedStartYear = (int)YearRangeComboBox.RangeStart;
SelectedEndYear = (int)YearRangeComboBox.RangeEnd;
SelectedEpChapterMin = (int)EpChapterSlider.RangeStart;
SelectedEpChapterMax = (int)EpChapterSlider.RangeEnd;
SelectedDurationVolumeMin = (int)DurationVolumeSlider.RangeStart;
SelectedDurationVolumeMax = (int)DurationVolumeSlider.RangeEnd;

SelectedGenres = TagGenres
.First(mediaTagsGenres => mediaTagsGenres.CategoryName is genreCategoryName)
Expand Down
20 changes: 20 additions & 0 deletions AniMoe.App/Helpers/AnimeListFilterBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ public class AnimeListFilterBuilder
private int? rangeStartYear;
private int? rangeEndYear; // 2025 as of 2024

private int? selectedEpChapterMin;
private int? selectedEpCahpterMax;

private int? selectedDurVolumeMin;
private int? selectedDurVolumeMax;

private IEnumerable<Entry> animeList;

public AnimeListFilterBuilder(IEnumerable<Entry> animeList)
Expand Down Expand Up @@ -73,6 +79,20 @@ public AnimeListFilterBuilder WithGenresInclude(List<string> genres)
return this;
}

public AnimeListFilterBuilder WithEpChapterRange(int? minValue, int? maxValue)
{
this.selectedEpChapterMin = minValue;
this.selectedEpCahpterMax = maxValue;
return this;
}

public AnimeListFilterBuilder WithDurationVolumeRange(int? minValue, int? maxValue)
{
this.selectedDurVolumeMin = minValue;
this.selectedDurVolumeMax = maxValue;
return this;
}

public AnimeListFilterBuilder WithGenresExclude(List<string> genres)
{
this.selectedNotInGenres = genres;
Expand Down

0 comments on commit 10cb4eb

Please sign in to comment.