parent
d478bb57fc
commit
f1c836480e
@ -0,0 +1,48 @@ |
|||||||
|
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
||||||
|
x:Class="Justice.Views.HelplinePage" |
||||||
|
Title="Helpline Numbers"> |
||||||
|
|
||||||
|
<StackLayout Padding="20"> |
||||||
|
<Label Text="Helpline Numbers" FontSize="Large" HorizontalOptions="Center" /> |
||||||
|
|
||||||
|
<!-- List of Helplines --> |
||||||
|
<ListView x:Name="HelplineListView" HasUnevenRows="True"> |
||||||
|
<ListView.ItemTemplate> |
||||||
|
<DataTemplate> |
||||||
|
<ViewCell> |
||||||
|
<Grid RowSpacing="5" ColumnSpacing="10"> |
||||||
|
<Grid.ColumnDefinitions> |
||||||
|
<ColumnDefinition Width="*" /> |
||||||
|
<!-- Equal width for each column --> |
||||||
|
<ColumnDefinition Width="*" /> |
||||||
|
<ColumnDefinition Width="*" /> |
||||||
|
<ColumnDefinition Width="*" /> |
||||||
|
</Grid.ColumnDefinitions> |
||||||
|
<Label Text="{Binding AuthorityType}" |
||||||
|
FontSize="Small" |
||||||
|
TextColor="Gray" |
||||||
|
Grid.Column="0" /> |
||||||
|
<Label Text="Number:" |
||||||
|
FontSize="Small" |
||||||
|
FontAttributes="Bold" |
||||||
|
TextColor="Gray" |
||||||
|
Grid.Column="1" |
||||||
|
HorizontalOptions="End" /> |
||||||
|
<Label Text="{Binding Number}" |
||||||
|
FontSize="Small" |
||||||
|
TextColor="Gray" |
||||||
|
Grid.Column="2" /> |
||||||
|
<Button Text="Call" |
||||||
|
FontSize="Small" |
||||||
|
Clicked="OnCallButtonClicked" |
||||||
|
CommandParameter="{Binding Number}" |
||||||
|
Grid.Column="3" |
||||||
|
HorizontalOptions="End" /> |
||||||
|
</Grid> |
||||||
|
</ViewCell> |
||||||
|
</DataTemplate> |
||||||
|
</ListView.ItemTemplate> |
||||||
|
</ListView> |
||||||
|
</StackLayout> |
||||||
|
</ContentPage> |
@ -0,0 +1,39 @@ |
|||||||
|
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<Helpline> Helplines { get; set; } |
||||||
|
|
||||||
|
public HelplinePage() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
Helplines = new ObservableCollection<Helpline>(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"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
namespace Justice.Views; |
||||||
|
|
||||||
|
public partial class InformationCenterPage : ContentPage |
||||||
|
{ |
||||||
|
public InformationCenterPage() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
} |
||||||
|
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue