Ca marche pas encore
continuous-integration/drone/push Build is passing Details

Popup_qui_marche_pas
Jade VAN BRABANDT 2 years ago
parent 5abc2e945a
commit 3e665acce3

@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace Model
@ -51,7 +52,7 @@ namespace Model
gameList.Remove(game);
mgrpersistance.SaveGame(gameList);
}
[ExcludeFromCodeCoverage]
public void SaveGames()
{
mgrpersistance.SaveGame(gameList);
@ -64,6 +65,7 @@ namespace Model
}
return null;
}
[ExcludeFromCodeCoverage]
public void SaveUser()
{
mgrpersistance.SaveUser(Users);

@ -31,7 +31,7 @@
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="10,0,0,0">
<Image Source="{Binding UserImage}" HeightRequest="200" WidthRequest="200" Margin="0,0,10,0"/>
<local:UserInfo Name="{Binding Username}" Button="0"/>
<local:UserInfo Name="{Binding Username}" Button="0" popUp="PopUp"/>
<Grid Margin="0,20,0,0">
<Grid.ColumnDefinitions>
@ -43,8 +43,8 @@
</Border>
<Button ImageSource="pen.png" Grid.Column="1" MaximumHeightRequest="32" MaximumWidthRequest="32" Padding="0,0,0,0" Margin="5,0,0,0" BackgroundColor="{StaticResource Gray500}"></Button>
</Grid>
<local:UserInfo Name="{Binding Password}" Button="2" />
<local:UserInfo Name="{Binding Email}" Button="3" />
<local:UserInfo Name="{Binding Password}" Button="2" popUp="PopUp"/>
<local:UserInfo Name="{Binding Email}" Button="3" popUp="PopUp"/>
</VerticalStackLayout>
<VerticalStackLayout Grid.Column="1" Margin="100,0,0,0">

@ -5,6 +5,7 @@ namespace Stim;
public partial class ProfilPage : ContentPage
{
delegate string delegatePopUp();
public ProfilPage()
{
InitializeComponent();
@ -22,4 +23,8 @@ public partial class ProfilPage : ContentPage
if (string.IsNullOrWhiteSpace(newName as string)) await this.ShowPopupAsync(new MessagePopup("Nom d'utilisateur invalide"));
else ((App)App.Current).Manager.CurrentUser.Username = (newName as string);
}
void PopUp(object sender, EventArgs e)
{
//handle method here
}
}

@ -10,7 +10,7 @@
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Margin="0,10,0,0" Padding="0">
<Label Text="{Binding Name, Source={x:Reference userInfoView}}" />
<Label Text="{Binding Name, Source={x:Reference PopUp}}" />
</Border>
<Button Clicked="Modif" ImageSource="pen.png" Grid.Column="1"
MaximumHeightRequest="32" MaximumWidthRequest="32"

@ -4,7 +4,11 @@ using CommunityToolkit.Maui.Views;
namespace Stim;
public partial class UserInfo : ContentView
{
public event EventHandler popUp;
public void PopUp(object sender, EventArgs e)
{
popUp?.Invoke(sender, e);
}
public string Name
{
get => (string)GetValue(NameProperty);
@ -28,38 +32,38 @@ public partial class UserInfo : ContentView
private async void Modif(object sender, EventArgs e)
{
if (Button == 0)
{
var result = await this.ShowPopupAsync(new EntryPopup("Username"));
if (string.IsNullOrWhiteSpace(result))
{
((App)App.Current).Manager.CurrentUser.Username = result;
}
}
else if (Button == 1)
{
var result = await this.(new EntryPopup("Username"));
if (string.IsNullOrWhiteSpace(result))
{
((App)App.Current).Manager.CurrentUser.Username = result;
}
}
else if (Button == 2)
{
var result = await this.(new EntryPopup("Password"));
if (string.IsNullOrWhiteSpace(result))
{
((App)App.Current).Manager.CurrentUser.Password = result;
}
}
else if (Button == 3)
{
var result = await this.(new EntryPopup("Email"));
if (string.IsNullOrWhiteSpace(result))
{
((App)App.Current).Manager.CurrentUser.Email = result;
}
}
else throw new ArgumentOutOfRangeException();
//if (Button == 0)
//{
// //var result = await CurrentPage.ShowPopupAsync(new EntryPopup("Username"));
// if (string.IsNullOrWhiteSpace((string)result))
// {
// ((App)App.Current).Manager.CurrentUser.Username = (string)result;
// }
//}
//else if (Button == 1)
//{
// //var result = await CurrentPage.ShowPopupAsync(new EntryPopup("Username"));
// if (string.IsNullOrWhiteSpace((string)result))
// {
// ((App)App.Current).Manager.CurrentUser.Username = (string)result;
// }
//}
//else if (Button == 2)
//{
// //var result = await CurrentPage.ShowPopupAsync(new EntryPopup("Username"));
// if (string.IsNullOrWhiteSpace((string)result))
// {
// ((App)App.Current).Manager.CurrentUser.Username = (string)result;
// }
//}
//else if (Button == 3)
//{
// //var result = await CurrentPage.ShowPopupAsync(new EntryPopup("Username"));
// if (string.IsNullOrWhiteSpace((string)result))
// {
// ((App)App.Current).Manager.CurrentUser.Username = (string)result;
// }
//}
throw new ArgumentOutOfRangeException();
}
}
Loading…
Cancel
Save