Nouveau header collection view
continuous-integration/drone/push Build is failing Details

pull/15/head
Yoan BRUGIÈRE 2 years ago
parent a80e43f9f9
commit d5d25d0453

@ -1,6 +1,8 @@
using Model.Stub;
using Microsoft.VisualBasic;
using Model.Stub;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -12,9 +14,10 @@ namespace Model
{
public IDataManager DataManager { get; set; }
public ObservableCollection<Bateau> Bateaux { get; private set; }
public Manager() {
Bateaux = new ObservableCollection<Bateau>();
DataManager = new StubManager();
}
@ -84,7 +87,36 @@ namespace Model
}
return listeFDD;
}
public List<ObjetOhara> RechercheObjetOhara(string text, List<ObjetOhara> liste)
{
if (text == "")
{
return liste;
}
foreach (ObjetOhara f in liste.ToList())
{
bool correspondance = false;
int textPos = 0;
for (int i = 0; i < (f.Nom.Length); i++)
{
if (string.Equals(text[textPos].ToString(), f.Nom[i].ToString(), StringComparison.OrdinalIgnoreCase))
{
textPos++;
}
if (textPos == text.Length)
{
correspondance = true;
break;
}
}
if (!correspondance)
{
liste.Remove(f);
}
}
return liste;
}
public List<ObjetOhara> GetFavoris()
{
List<ObjetOhara> listeFavoris = new List<ObjetOhara>();

@ -17,13 +17,13 @@
<Grid HeightRequest="200" BackgroundColor="Black" Margin="0,0,0,20">
<Image Source="ohara2.png" Aspect="Fill" Opacity="0.8" />
<Label Text="Ohara" FontSize="33" TextColor="White" HorizontalOptions="Center" VerticalOptions="Center" FontAttributes="Bold/>
<Label Text="Ohara" FontSize="33" TextColor="White" HorizontalOptions="Center" VerticalOptions="Center" FontAttributes="Bold"/>
<Line X1="0" Y1="0" X2="3000" Y2="0" StrokeThickness="5" Stroke="#72a3b3" VerticalOptions="End" />
</Grid>
</Shell.FlyoutHeader>
<ShellContent Title="Acceuil" ContentTemplate="{DataTemplate local:MainPage}" />
<ShellContent Title="Accueil" ContentTemplate="{DataTemplate local:MainPage}" />
<ShellContent Title="Favoris" ContentTemplate="{DataTemplate local:PageFavoris}" />
<ShellContent Title="Carte" ContentTemplate="{DataTemplate local:PageCarte}" />
<ShellContent Title="Personnages" ContentTemplate="{DataTemplate local:PagePersonnage}" />

@ -10,35 +10,16 @@
<CollectionView x:Name="listeBest" ItemsLayout="VerticalGrid, 4" EmptyView="Aucun résultat trouvé." SelectionMode="Single" SelectionChanged="listeBest_SelectionChanged">
<CollectionView.Header>
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" >
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0" x:Name="searchBar" />
<Frame Grid.Column="2" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" >
<Label Text="Filtrer" />
<FlyoutBase.ContextFlyout>
<MenuFlyout >
<MenuFlyoutItem x:Name="Logia" Text="Logia" />
</MenuFlyout>
</FlyoutBase.ContextFlyout>
<Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="4">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
</CollectionView.Header>
<CollectionView.ItemTemplate>

@ -12,35 +12,16 @@
<GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="15" VerticalItemSpacing="15"/>
</CollectionView.ItemsLayout>
<CollectionView.Header>
<Grid BackgroundColor="#72a3b3" Padding="10" ColumnSpacing="50" >
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="20*"/>
<ColumnDefinition Width="25*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0" x:Name="searchBar" />
<Frame Grid.Column="2" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" >
<Label Text="Filtrer" />
<FlyoutBase.ContextFlyout>
<MenuFlyout >
<MenuFlyoutItem x:Name="Logia" Text="Logia" />
</MenuFlyout>
</FlyoutBase.ContextFlyout>
<Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="3">
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="4">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</Grid>
</CollectionView.Header>
<CollectionView.ItemTemplate >

@ -10,17 +10,17 @@
<GridItemsLayout Orientation="Vertical" Span="4" HorizontalItemSpacing="15" VerticalItemSpacing="15"/>
</CollectionView.ItemsLayout>
<CollectionView.Header>
<HorizontalStackLayout BackgroundColor="#72a3b3" Padding="10" Spacing="80">
<SearchBar Placeholder="Rechercher..." BackgroundColor="#bfe5ef" WidthRequest="200"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef">
<Grid ColumnDefinitions="200,*,100,10,100" BackgroundColor="#72a3b3" Padding="10">
<SearchBar x:Name="searchBar" Placeholder="Rechercher..." BackgroundColor="#bfe5ef" Grid.Column="0"/>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="2">
<Label Text="Filtrer" HorizontalTextAlignment="Center" />
</Frame>
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" >
<Frame CornerRadius="20" BackgroundColor="#bfe5ef" BorderColor="#bfe5ef" Grid.Column="4">
<Label Text="Trier" HorizontalTextAlignment="Center" />
</Frame>
</HorizontalStackLayout>
</Grid>
</CollectionView.Header>
<CollectionView.ItemTemplate>

@ -11,6 +11,12 @@ public partial class PageFavoris : ContentPage
{
InitializeComponent();
listeFavs.ItemsSource = manager.GetFavoris();
void OnTextChanged(object sender, EventArgs e)
{
SearchBar searchBar = (SearchBar)sender;
listeFavs.ItemsSource = manager.RechercheObjetOhara(searchBar.Text, manager.GetFavoris());
}
searchBar.TextChanged += OnTextChanged;
}
async void listeFavs_SelectionChanged(object sender, SelectionChangedEventArgs e)

Loading…
Cancel
Save