using Justice.Models; using Justice.Services; using Microsoft.Maui.ApplicationModel.Communication; using System; using System.Collections.ObjectModel; namespace Justice.Views { public partial class HelplinePage : ContentPage { public ObservableCollection Helplines { get; set; } public HelplinePage() { InitializeComponent(); Helplines = new ObservableCollection(HelplineService.GetHelplines()); HelplineListView.ItemsSource = Helplines; } private async void OnCallButtonClicked(object sender, EventArgs e) { if (sender is Button button && button.CommandParameter is string phoneNumber) { bool confirm = await DisplayAlert("Call Helpline", $"Do you want to call {phoneNumber}?", "Yes", "No"); if (confirm) { try { PhoneDialer.Open(phoneNumber); } catch (Exception ex) { await DisplayAlert("Error", $"Unable to make the call: {ex.Message}", "OK"); } } } } } }