Merge branch 'develop' of https://codefirst.iut.uca.fr/git/nicolas.blondeau/SAE_2.01_-_Developpement_dune_application into develop
continuous-integration/drone/push Build is passing Details

Collection
commit 7775ef639c

@ -53,7 +53,7 @@ namespace Model
Texte = texte;
LeMonstre = leMonstre;
}
// Pour afficher les conseils.
// FONCTION A DEPLACER -> Dans la console, ON AFFICHE RIEN DANS LE MODEL !!!
public void affichConseil()
{
Console.WriteLine($"Id : {Id}");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 418 B

@ -156,7 +156,7 @@
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label Text="{Binding ., StringFormat='{0}'}" FontSize="Small" VerticalOptions="Fill"/>
<Label Text="{Binding ., StringFormat='{0}'}" FontSize="Small" VerticalOptions="Fill"/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
@ -178,10 +178,10 @@
<StackLayout Grid.Row="1">
<Border Style="{StaticResource sectionStyle}" HeightRequest="160">
<Border Style="{StaticResource sectionStyle}">
<StackLayout>
<Label TextDecorations="Underline" Text="Apparences :" FontSize="Medium"/>
<ListView x:Name="ListAppearance" ItemsSource="{Binding AppearanceList}" Grid.Row="1" ItemTapped="ListAppearance_ItemTapped">
<ListView x:Name="ListAppearance" VerticalOptions="Fill" ItemsSource="{Binding AppearanceList}" Grid.Row="1" ItemTapped="ListAppearance_ItemTapped">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
@ -196,28 +196,66 @@
<!-- Conseils -->
<Border Grid.Row="3" Style="{StaticResource sectionStyle}">
<StackLayout>
<Button Text="Ajouter un conseil" Grid.Row="0" Grid.Column="1" Clicked="OnAddConseilClicked" />
<StackLayout x:Name="AddConseilLayout" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" IsVisible="False">
<Editor x:Name="texteConseilEntry" Placeholder="Texte du conseil" PlaceholderColor="{StaticResource Gray500}"/>
<Button Text="Valider" Clicked="OnValiderConseilClicked" />
<Button Text="Annuler" Clicked="OnExitConseilClicked" />
</StackLayout>
<ListView x:Name="ListViewConseils" ItemsSource="{Binding ListConseils}" Grid.Row="1">
<Label TextDecorations="Underline" Text="Conseils :" FontSize="Medium"/>
<!-- Bouton d'ajout de conseil -->
<Button x:Name="ButtonAddConseil" Margin="8" HorizontalOptions="End" IsVisible="False" Text="Ajouter un conseil" Grid.Row="0" Grid.Column="1" Clicked="OnAddConseilClicked" />
<VerticalStackLayout x:Name="AddConseilLayout" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" IsVisible="False">
<Editor x:Name="texteConseilEntry" TextChanged="texteConseilEntry_TextChanged" AutoSize="TextChanges" Placeholder="Texte du conseil" PlaceholderColor="{StaticResource Gray500}"/>
<Grid ColumnDefinitions="*,*" Padding="8" HorizontalOptions="CenterAndExpand">
<Button Grid.Column="0" Text="Valider" Clicked="OnValiderConseilClicked" />
<Button Grid.Column="1" Text="Annuler" Clicked="OnExitConseilClicked" />
</Grid>
</VerticalStackLayout>
<ListView x:Name="ListViewConseils" VerticalOptions="Fill" ItemsSource="{Binding ListConseils}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid RowDefinitions="Auto" ColumnDefinitions="Auto, Auto">
<Label Text="{Binding Id}" Grid.Column="0"/>
<Label Text="{Binding Auteur}" Grid.Column="0"/>
<Label Text="{Binding Texte}" Grid.Column="1" />
<!-- Bouton d'ajout de conseil -->
</Grid>
<Border BackgroundColor="AntiqueWhite" StrokeThickness="2" StrokeShape="RoundRectangle 10">
<VisualStateManager.VisualStateGroups>
<VisualStateGroupList>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter TargetName="ConseilOptions" Property="IsVisible"
Value="true" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Normal">
<VisualState.Setters>
<Setter TargetName="ConseilOptions" Property="IsVisible"
Value="false" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</VisualStateManager.VisualStateGroups>
<Grid ColumnDefinitions="*,90" RowDefinitions="*" Padding="0" MinimumHeightRequest="50" HorizontalOptions="Fill" VerticalOptions="Fill">
<!-- LA je ne comprends pas : pour que les VisualStates
fonctionnent sur tout le grid, et pas que sur le texte du label, il faut rajouter un background?? Bizarre...-->
<VerticalStackLayout Padding="15,10,10,10" Grid.Column="0" VerticalOptions="Center">
<Label BindingContext="{Binding Auteur}" Text="{Binding Pseudo, StringFormat='{0} :'}"/>
<Label VerticalOptions="Fill" LineBreakMode="WordWrap" Text="{Binding Texte, StringFormat='{0}'}" />
</VerticalStackLayout>
<!-- Les boutons de modifications et de suppression-->
<HorizontalStackLayout x:Name="ConseilOptions" Grid.Column="1" HorizontalOptions="End" IsVisible="False">
<ImageButton CornerRadius="5" Scale="0.7" Source="pencil.png" HeightRequest="12" WidthRequest="12"/>
<ImageButton CornerRadius="5" Scale="0.7" Source="bin.png" HeightRequest="12" WidthRequest="12"/>
</HorizontalStackLayout>
</Grid>
</Border>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</Border>
</StackLayout>
</Grid>
</ScrollView>

@ -1,11 +1,11 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Layouts;
using Model;
using Persistance;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
namespace Vues;
public partial class SearchMob : ContentPage, INotifyPropertyChanged
@ -41,39 +41,38 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged
imageCollection.BindingContext = this;
if ((Application.Current as App).User != null)
{
ButtonAddConseil.IsVisible = true;
}
}
public void refreshScrollView()
{
ScrollLayoutThatNeedsToBeRefreshed.IsVisible = false;
ScrollLayoutThatNeedsToBeRefreshed.IsVisible = true;
}
public void OnClick(object sender, ItemTappedEventArgs e)
{
(App.Current as App).MonstreSelectionne = e.Item as Monstre;
imageCollection.Source = imageLinkConverter((App.Current as App).MonstreSelectionne.AppearanceList.First());
AddConseilLayout.IsVisible = false;
refreshScrollView();
}
private void OnAddConseilClicked(object sender, EventArgs e)
{
var button = sender as Button;
// Afficher les champs à remplir pour ajouter un conseil
//FAIRE UN FUCKING X:NAME :>
var addConseilLayout = button?.Parent?.FindByName<StackLayout>("AddConseilLayout");
if (addConseilLayout != null)
if (!AddConseilLayout.IsVisible)
{
ScrollLayoutThatNeedsToBeRefreshed.IsVisible = false;
addConseilLayout.IsVisible = true;
ScrollLayoutThatNeedsToBeRefreshed.IsVisible = true;
AddConseilLayout.IsVisible = true;
texteConseilEntry.Text = null;
refreshScrollView();
}
}
private void OnValiderConseilClicked(object sender, EventArgs e)
{
var button = sender as Button;
//FAIRE UN FUCKING ICI AUSSI X:NAME :>
var addConseilLayout = button?.Parent?.FindByName<StackLayout>("AddConseilLayout");
if (addConseilLayout != null)
if (AddConseilLayout != null)
{
var texteConseil = texteConseilEntry.Text;
string texteConseil = texteConseilEntry.Text;
// Ajouter le nouveau conseil à la liste des conseils du monstre sélectionné
var selectedMonstre = (App.Current as App).MonstreSelectionne;
if (selectedMonstre != null && !string.IsNullOrWhiteSpace(texteConseil))
@ -81,18 +80,16 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged
var nouveauConseil = new Conseil((App.Current as App).User, texteConseil, selectedMonstre);
selectedMonstre.ListConseils.Add(nouveauConseil);
}
texteConseilEntry.Text = string.Empty;
addConseilLayout.IsVisible = false;
texteConseilEntry.Text = null;
AddConseilLayout.IsVisible = false;
}
refreshScrollView();
}
private void OnExitConseilClicked(object sender, EventArgs e)
{
var button = sender as Button;
var addConseilLayout = button?.Parent?.FindByName<StackLayout>("AddConseilLayout");
var texteConseilEntry = addConseilLayout.Children[1] as Editor;
texteConseilEntry.Text = string.Empty;
addConseilLayout.IsVisible = false;
texteConseilEntry.Text = null;
AddConseilLayout.IsVisible = false;
}
private string imageLinkConverter(string imageLink)
@ -106,21 +103,12 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged
{
appearanceSelected = e.Item as string;
imageCollection.Source = imageLinkConverter(appearanceSelected);
}
private void FilterClicked(object sender, EventArgs e) // Afficher les filtres
private void FilterClicked(object sender, EventArgs e)
{
var button = sender as Button;
var afficherFiltres = button?.Parent?.FindByName<HorizontalStackLayout>("HorizonFilterClicked");
if (afficherFiltres.IsVisible)
{
afficherFiltres.IsVisible = false;
}
else
{
afficherFiltres.IsVisible |= true;
}
// Inverse la valeur booléenne de IsVisible => Permet d'afficher ou non les boutons de filtrage
HorizonFilterClicked.IsVisible = !HorizonFilterClicked.IsVisible;
}
private void UpdateAffichMobs()
@ -151,4 +139,9 @@ public partial class SearchMob : ContentPage, INotifyPropertyChanged
{
SearchText = e.NewTextValue;
}
private void texteConseilEntry_TextChanged(object sender, TextChangedEventArgs e)
{
(ScrollLayoutThatNeedsToBeRefreshed as IView).InvalidateMeasure(); //Permet de recalculer la taille de la scrollView
}
}
Loading…
Cancel
Save