Feat : BindingProperty popup =>Marche pas sur contentview ?
continuous-integration/drone/push Build was killed
Details
continuous-integration/drone/push Build was killed
Details
parent
313f69f1de
commit
5abc2e945a
@ -1,28 +1,65 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using CommunityToolkit.Maui.Views;
|
||||
|
||||
namespace Stim;
|
||||
public partial class UserInfo : ContentView
|
||||
{
|
||||
public static readonly BindableProperty BindProperty =
|
||||
BindableProperty.Create(nameof(Bind), typeof(string), typeof(UserInfo), string.Empty, propertyChanged: OnBindChanged);
|
||||
|
||||
public string Bind
|
||||
public string Name
|
||||
{
|
||||
get { return (string)GetValue(BindProperty); }
|
||||
set { SetValue(BindProperty, value); }
|
||||
get => (string)GetValue(NameProperty);
|
||||
set => SetValue(NameProperty, value);
|
||||
}
|
||||
public static readonly BindableProperty NameProperty =
|
||||
BindableProperty.Create(nameof(Name), typeof(string), typeof(UserInfo), "Erreur");
|
||||
|
||||
private static void OnBindChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
public int Button
|
||||
{
|
||||
var contentView = (UserInfo)bindable;
|
||||
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();
|
||||
BindingContext = ((App)App.Current).Manager;
|
||||
}
|
||||
|
||||
private void Button_Clicked(object sender, EventArgs e)
|
||||
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();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue