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

@ -31,7 +31,7 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="10,0,0,0"> <VerticalStackLayout Grid.Column="0" Margin="10,0,0,0">
<Image Source="{Binding UserImage}" HeightRequest="200" WidthRequest="200" Margin="0,0,10,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 Margin="0,20,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -43,8 +43,8 @@
</Border> </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> <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> </Grid>
<local:UserInfo Name="{Binding Password}" Button="2" /> <local:UserInfo Name="{Binding Password}" Button="2" popUp="PopUp"/>
<local:UserInfo Name="{Binding Email}" Button="3" /> <local:UserInfo Name="{Binding Email}" Button="3" popUp="PopUp"/>
</VerticalStackLayout> </VerticalStackLayout>
<VerticalStackLayout Grid.Column="1" Margin="100,0,0,0"> <VerticalStackLayout Grid.Column="1" Margin="100,0,0,0">

@ -5,6 +5,7 @@ namespace Stim;
public partial class ProfilPage : ContentPage public partial class ProfilPage : ContentPage
{ {
delegate string delegatePopUp();
public ProfilPage() public ProfilPage()
{ {
InitializeComponent(); 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")); 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); 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="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Margin="0,10,0,0" Padding="0"> <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> </Border>
<Button Clicked="Modif" ImageSource="pen.png" Grid.Column="1" <Button Clicked="Modif" ImageSource="pen.png" Grid.Column="1"
MaximumHeightRequest="32" MaximumWidthRequest="32" MaximumHeightRequest="32" MaximumWidthRequest="32"

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