Compare commits

1 Commits

Author SHA1 Message Date
b9d2769f6d Implementata gestione bottoni form in base al contesto 2026-02-05 08:30:20 +01:00

View File

@@ -52,7 +52,8 @@ namespace PizzaExpress_Client
{ {
Text = "Costo", Text = "Costo",
Location = new Point(900, 15), Location = new Point(900, 15),
Size = new Size(70, 30) Size = new Size(70, 30),
Enabled = false
}; };
_btnCosto.Click += BtnCosto_Click; _btnCosto.Click += BtnCosto_Click;
@@ -196,9 +197,9 @@ namespace PizzaExpress_Client
Padding = new Padding(0, 10, 0, 0) Padding = new Padding(0, 10, 0, 0)
}; };
_btnAggiungi = new Button { Text = "Aggiungi", Width = 120 }; _btnAggiungi = new Button { Text = "Aggiungi", Width = 120, Enabled = false };
_btnAggiorna = new Button { Text = "Aggiorna", Width = 120 }; _btnAggiorna = new Button { Text = "Aggiorna", Width = 120, Enabled = false };
_btnElimina = new Button { Text = "Elimina", Width = 120 }; _btnElimina = new Button { Text = "Elimina", Width = 120, Enabled = false };
_btnAggiungi.Click += async (s, e) => await AggiungiPizza(); _btnAggiungi.Click += async (s, e) => await AggiungiPizza();
_btnAggiorna.Click += async (s, e) => await AggiornaPizza(); _btnAggiorna.Click += async (s, e) => await AggiornaPizza();
@@ -269,6 +270,11 @@ namespace PizzaExpress_Client
_cmbCategoria.Text = p.Categoria; _cmbCategoria.Text = p.Categoria;
_txtNote.Text = p.Note; _txtNote.Text = p.Note;
_cmbStato.Text = p.Stato; _cmbStato.Text = p.Stato;
_btnAggiungi.Enabled = false;
_btnElimina.Enabled = true;
_btnAggiorna.Enabled = true;
_btnCosto.Enabled = true;
} }
// ====================================================================== // ======================================================================
@@ -388,6 +394,11 @@ namespace PizzaExpress_Client
_txtNote.Clear(); _txtNote.Clear();
_cmbCategoria.SelectedIndex = -1; _cmbCategoria.SelectedIndex = -1;
_cmbStato.SelectedIndex = -1; _cmbStato.SelectedIndex = -1;
_btnAggiungi.Enabled = true;
_btnElimina.Enabled = false;
_btnAggiorna.Enabled = false;
_btnCosto.Enabled = false;
} }
} }
} }