Fix : Ca marche mais c'moche mais ça marche
continuous-integration/drone/push Build is passing Details

Popup_qui_marche_pas
Jade VAN BRABANDT 2 years ago
parent e034cf23c0
commit 1fc29ae650

@ -5,6 +5,7 @@ using StimStub;
using Microsoft.Maui.Storage; using Microsoft.Maui.Storage;
using MailKit.Search; using MailKit.Search;
using System.Linq; using System.Linq;
using System.Collections.Generic;
public partial class MainPage : ContentPage public partial class MainPage : ContentPage
{ {
@ -31,18 +32,65 @@ public partial class MainPage : ContentPage
string Tag1Text = Tag1.Text; string Tag1Text = Tag1.Text;
string Tag2Text = Tag2.Text; string Tag2Text = Tag2.Text;
((App)App.Current).Manager.ResearchedGame.Clear(); ((App)App.Current).Manager.ResearchedGame.Clear();
IEnumerable<Game> filteredGames = ((App)App.Current).Manager.GameList;
var filteredGames = ((App)App.Current).Manager.GameList if (GameText != null && Tag1Text != null && Tag2.Text != null)
{
filteredGames = ((App)App.Current).Manager.GameList
.Where(game => game.Name.IndexOf(GameText, StringComparison.OrdinalIgnoreCase) >= 0 .Where(game => game.Name.IndexOf(GameText, StringComparison.OrdinalIgnoreCase) >= 0
&& &&
game.Tags.Any(tag => tag.IndexOf(Tag1Text, StringComparison.OrdinalIgnoreCase) >= 0) game.Tags.Any(tag => tag.IndexOf(Tag1Text, StringComparison.OrdinalIgnoreCase) >= 0)
&& &&
game.Tags.Any(tag => tag.IndexOf(Tag2Text, StringComparison.OrdinalIgnoreCase) >= 0) game.Tags.Any(tag => tag.IndexOf(Tag2Text, StringComparison.OrdinalIgnoreCase) >= 0)
); );
}
if (GameText == null && Tag1Text !=null && Tag2Text !=null)
{
filteredGames = ((App)App.Current).Manager.GameList
.Where(game => game.Tags.Any(tag => tag.IndexOf(Tag1Text, StringComparison.OrdinalIgnoreCase) >= 0)
&&
game.Tags.Any(tag => tag.IndexOf(Tag2Text, StringComparison.OrdinalIgnoreCase) >= 0)
);
}
if (GameText != null && Tag1Text == null && Tag2Text != null)
{
filteredGames = ((App)App.Current).Manager.GameList
.Where(game => game.Name.IndexOf(GameText, StringComparison.OrdinalIgnoreCase) >= 0
&&
game.Tags.Any(tag => tag.IndexOf(Tag2Text, StringComparison.OrdinalIgnoreCase) >= 0)
);
}
if (GameText != null && Tag1Text != null && Tag2Text == null)
{
filteredGames = ((App)App.Current).Manager.GameList
.Where(game => game.Name.IndexOf(GameText, StringComparison.OrdinalIgnoreCase) >= 0
&&
game.Tags.Any(tag => tag.IndexOf(Tag1Text, StringComparison.OrdinalIgnoreCase) >= 0)
);
}
if (GameText == null && Tag1Text==null && Tag2Text!=null)
{
filteredGames = ((App)App.Current).Manager.GameList
.Where(game => game.Tags.Any(tag => tag.IndexOf(Tag2Text, StringComparison.OrdinalIgnoreCase) >= 0)
);
}
if (GameText==null &&Tag1Text!=null&& Tag2Text ==null)
{
filteredGames = ((App)App.Current).Manager.GameList
.Where(game => game.Tags.Any(tag => tag.IndexOf(Tag1Text, StringComparison.OrdinalIgnoreCase) >= 0)
);
}
if (GameText!=null&& Tag1Text == null && Tag2Text==null)
{
filteredGames = ((App)App.Current).Manager.GameList
.Where(game => game.Name.IndexOf(GameText, StringComparison.OrdinalIgnoreCase) >= 0
);
}
foreach (var game in filteredGames) foreach (var game in filteredGames)
{ {
((App)App.Current).Manager.ResearchedGame.Add(game); ((App)App.Current).Manager.ResearchedGame.Add(game);
} }
} }
} }

Loading…
Cancel
Save