Untitled
unknown
plain_text
9 months ago
1.7 kB
0
Indexable
using System.Collections.ObjectModel; using UraniumUI; using System; using System.Threading.Tasks; using GroceryPalAdmin.Models; using Microsoft.Maui.Controls; using GroceryPalAdmin.Views; using Firebase.Database; using static GroceryPalAdmin.Models.Products; namespace GroceryPalAdmin.Views; public partial class Productlists : ContentPage { public Productlists() { InitializeComponent(); BindingContext = new ProductsViewModel(); } private void Btnback_OnClicked_OnClicked(object? sender, EventArgs e) { Application.Current.MainPage = new Storedashboard(); } private async void Btndelete_OnClicked(object sender, EventArgs e) { var button = sender as Button; var product = button?.BindingContext as Products; if (!await DisplayAlert("Delete Product", "You are about to delete this Product. All associated data from the account with this product will be removed. You will have to enter the product list again when you decide to comeback." + "Do you really want to leave?", "Yes", "No")) return; if (product != null) { var viewModel = BindingContext as ProductsViewModel; if (viewModel != null) { viewModel.RemoveItemCommand.Execute(product); } } } private void Btnedit_OnClicked(object sender, EventArgs e) { var button = sender as Button; var product = button?.BindingContext as Products; if (product != null) { Navigation.PushAsync(new EditProduct(product)); } } }
Editor is loading...
Leave a Comment