popup suivre un jeu et popup pour le chagement sur info de l'utilisateur (reste plus qu'à la mettre sur les boutons)

Popup_qui_marche_pas
Anthony RICHARD 2 years ago
parent de4f4e25ad
commit 9118f7a5ab

@ -1,17 +0,0 @@
using CommunityToolkit.Maui.Views;
namespace Stim;
public partial class AddGameMessagePopup : Popup
{
public AddGameMessagePopup(string message)
{
InitializeComponent();
placeholder.Text = message;
}
public void CloseButton(object sender, EventArgs e)
{
Close();
}
}

@ -34,7 +34,7 @@ public partial class AddGamePage : ContentPage
} }
// //if (_ImgPath!=null) NameEntry.Text + ".png"; // //if (_ImgPath!=null) NameEntry.Text + ".png";
// //System.IO.File.Copy(_ImgPath, /**/, true); // //System.IO.File.Copy(_ImgPath, /**/, true);
await this.ShowPopupAsync(new AddGameMessagePopup(message)); await this.ShowPopupAsync(new MessagePopup(message));
} }
private async void Button_Clicked(object sender, EventArgs e) private async void Button_Clicked(object sender, EventArgs e)

@ -1,3 +1,4 @@
using CommunityToolkit.Maui.Views;
using Model; using Model;
using StimPersistance; using StimPersistance;
@ -39,8 +40,9 @@ public partial class DetailledPage : ContentPage
//popup add review //popup add review
} }
private void AddFollow(object sender, EventArgs e) private async void AddFollow(object sender, EventArgs e)
{ {
await this.ShowPopupAsync(new MessagePopup("Jeu ajouté dans les suivis !"));
((App)App.Current).Manager.CurrentUser.FollowAGame(CurrGame); ((App)App.Current).Manager.CurrentUser.FollowAGame(CurrGame);
} }
} }

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="Stim.EntryPopup"
CanBeDismissedByTappingOutsideOfPopup="False">
<VerticalStackLayout>
<Grid ColumnDefinitions="*" RowDefinitions="auto, auto, auto">
<Label x:Name="LabelTxt"/>
<Entry Grid.Row="1"/>
<Button Grid.Row="2" x:Name="Entrytxt" Text="Valider" HorizontalOptions="Center" VerticalOptions="End" Background="{StaticResource Transparent}" Clicked="CloseButton"/>
</Grid>
</VerticalStackLayout>
</toolkit:Popup>

@ -0,0 +1,17 @@
using CommunityToolkit.Maui.Views;
namespace Stim;
public partial class EntryPopup : Popup
{
public EntryPopup(string fieldName)
{
InitializeComponent();
LabelTxt.Text = fieldName;
}
public void CloseButton(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(Entrytxt.Text)) Close(Entrytxt.Text);
}
}

@ -16,10 +16,10 @@
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="0" Grid.Row="1"/> <VerticalStackLayout BackgroundColor="Black" Grid.Column="0" Grid.RowSpan="2"/>
<VerticalStackLayout BackgroundColor="Black" Grid.Column="2" Grid.Row="1"/> <VerticalStackLayout BackgroundColor="Black" Grid.Column="2" Grid.RowSpan="2"/>
<CollectionView ItemsSource="{Binding Followed_Games}" Grid.Column="1" SelectionChanged="GoToDetail"> <CollectionView ItemsSource="{Binding Followed_Games}" SelectionMode="Single" Grid.Column="1" SelectionChanged="GoToDetail">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Border HeightRequest="150"> <Border HeightRequest="150">

@ -2,10 +2,11 @@
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="Stim.AddGameMessagePopup" x:Class="Stim.MessagePopup"
CanBeDismissedByTappingOutsideOfPopup ="False"> CanBeDismissedByTappingOutsideOfPopup ="False">
<VerticalStackLayout Background="{StaticResource Transparent}">
<Grid RowDefinitions="auto, *" ColumnDefinitions="*"> <VerticalStackLayout>
<Grid RowDefinitions="auto, auto" ColumnDefinitions="*">
<Label x:Name="placeholder" Text="" HorizontalOptions="Center"/> <Label x:Name="placeholder" Text="" HorizontalOptions="Center"/>
<Button Grid.Row="1" Text="Fermer" HorizontalOptions="Center" VerticalOptions="End" Background="{StaticResource Transparent}" Clicked="CloseButton"/> <Button Grid.Row="1" Text="Fermer" HorizontalOptions="Center" VerticalOptions="End" Background="{StaticResource Transparent}" Clicked="CloseButton"/>
</Grid> </Grid>

@ -0,0 +1,17 @@
using CommunityToolkit.Maui.Views;
namespace Stim;
public partial class MessagePopup : Popup
{
public MessagePopup(string message)
{
InitializeComponent();
placeholder.Text = message;
}
public void CloseButton(object sender, EventArgs e)
{
Close();
}
}

@ -1,3 +1,4 @@
using CommunityToolkit.Maui.Views;
using Model; using Model;
namespace Stim; namespace Stim;
@ -14,4 +15,11 @@ public partial class ProfilPage : ContentPage
{ {
((App)App.Current).Manager.CurrentUser.RemoveAGame((sender as CollectionView).SelectedItem as Game); ((App)App.Current).Manager.CurrentUser.RemoveAGame((sender as CollectionView).SelectedItem as Game);
} }
private async void ChangeUsername(object sender, EventArgs e)
{
var newName = await this.ShowPopupAsync(new EntryPopup("Username"));
if (string.IsNullOrWhiteSpace(newName as string)) await this.ShowPopupAsync(new MessagePopup("Nom d'utilisateur invalide"));
else ((App)App.Current).Manager.CurrentUser.ChangeUsername(newName as string);
}
} }

@ -77,9 +77,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<MauiXaml Update="AddGameMessagePopup.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="AddGamePage.xaml"> <MauiXaml Update="AddGamePage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
@ -89,12 +86,18 @@
<MauiXaml Update="DetailledPage.xaml"> <MauiXaml Update="DetailledPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="EntryPopup.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="LoginPage.xaml"> <MauiXaml Update="LoginPage.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="Create.xaml"> <MauiXaml Update="Create.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>
<MauiXaml Update="MessagePopup.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="UserInfo.xaml"> <MauiXaml Update="UserInfo.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</MauiXaml> </MauiXaml>

Loading…
Cancel
Save