You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Projet_IHM/Sources/Stim/UserInfo.xaml.cs

65 lines
2.0 KiB

using Microsoft.VisualBasic;
using CommunityToolkit.Maui.Views;
namespace Stim;
public partial class UserInfo : ContentView
{
public string Name
{
get => (string)GetValue(NameProperty);
set => SetValue(NameProperty, value);
}
public static readonly BindableProperty NameProperty =
BindableProperty.Create(nameof(Name), typeof(string), typeof(UserInfo), "Erreur");
public int Button
{
get => (int)GetValue(ButtonProperty);
set => SetValue(ButtonProperty, value);
}
public static readonly BindableProperty ButtonProperty =
BindableProperty.Create(nameof(Button), typeof(int), typeof(UserInfo), 4);
public UserInfo()
{
InitializeComponent();
}
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();
}
}