Dodano edycje danych osoby - Zmodyfikowano User.cs, DetailedViewModel.cs, DetailedPage.xaml oraz MainPage.xaml

This commit is contained in:
Krzysztof KrzysiekSiemv Smaga
2025-03-17 21:03:15 +01:00
parent 582c0f69ab
commit 19037d6d4a
25 changed files with 4221 additions and 4278 deletions
+51 -2
View File
@@ -1,2 +1,51 @@
// Huh... no nic nie ma, co tu chcesz?
// ༼ つ ◕_◕ ༽つ
using System.Windows.Input;
using Navigation_Between.Model;
namespace Navigation_Between.ViewModel;
public class DetailedViewModel
{
public User SelectedUser { get; }
public ICommand EditDescriptionCommand { get; }
public ICommand EditEmailCommand { get; }
public DetailedViewModel(User user)
{
SelectedUser = user;
EditDescriptionCommand = new Command(async () => await EditDescription());
EditEmailCommand = new Command(async () => await EditEmail());
}
private async Task EditDescription()
{
string result = await Shell.Current.DisplayPromptAsync(
"Edytuj opis",
"Podaj nowy opis:",
"OK",
"Anuluj",
SelectedUser.Description
);
if (!string.IsNullOrWhiteSpace(result)){
SelectedUser.Description = result;
}
}
private async Task EditEmail()
{
string result = await Shell.Current.DisplayPromptAsync(
"Edytuj e-mail",
"Podaj nowy adres e-mail:",
"OK",
"Anuluj",
SelectedUser.Email
);
if (!string.IsNullOrWhiteSpace(result))
{
SelectedUser.Email = result;
}
}
}