Przeprowadzka
This commit is contained in:
Executable
+37
@@ -0,0 +1,37 @@
|
||||
using System.Windows.Input;
|
||||
using System.ComponentModel;
|
||||
using System.Collections.ObjectModel;
|
||||
using Microsoft.Maui.Controls;
|
||||
|
||||
namespace HomePantry.Views;
|
||||
|
||||
public partial class AddProductPage : ContentPage
|
||||
{
|
||||
|
||||
public ICommand ButtonCommand { get; }
|
||||
public AddProductPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
pickKategoria.ItemsSource = new List<string>
|
||||
{
|
||||
"Nabiał", "Pieczywo", "Mięso i wędliny", "Warzywa i owoce", "Napoje", "Inne"
|
||||
};
|
||||
dpWaznosc.MinimumDate = DateTime.Now;
|
||||
|
||||
ButtonCommand = new Command(async() => await btnDodaj_Clicked());
|
||||
btnDodaj.Command = ButtonCommand;
|
||||
}
|
||||
|
||||
private async Task btnDodaj_Clicked()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(entNazwa.Text) && !string.IsNullOrEmpty(entIlosc.Text) && !string.IsNullOrEmpty(entJednostka.Text))
|
||||
{
|
||||
string otwarty = swOtwarte.IsToggled ? "Tak" : "Nie";
|
||||
await DisplayAlertAsync("Spiżarnia", $"Produkt: {entNazwa.Text}\nIlość: {entIlosc.Text} {entJednostka.Text}\nKategoria: {pickKategoria.SelectedItem?.ToString() ?? "brak"}\nWażność: {dpWaznosc.Date}\nOtwarty: {otwarty}\nUwagi: {edtUwagi.Text ?? "brak"}", "OK");
|
||||
}
|
||||
else
|
||||
{
|
||||
await DisplayAlertAsync("Spiżarnia", "Należy uzupełnić wszystkie wymagane pola!", "OK");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user