You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Seekers/App.xaml.cs

36 lines
1011 B

6 months ago
using Justice.Helpers;
using Justice.Models;
namespace Justice
{
public partial class App : Application
{
public App()
{
InitializeComponent();
6 months ago
InitializeDatabaseAsync();
// Call the async method to initialize the database
6 months ago
}
private async void InitializeDatabaseAsync()
{
try
{
var dbHelper = new DatabaseHelper();
6 months ago
await dbHelper.InitializeAsync<EmergencyContact>();
6 months ago
await dbHelper.InitializeAsync<IncidentReport>();
await dbHelper.InitializeAsync<User>();// Asynchronously create the EmergencyContact table
6 months ago
}
catch (Exception ex)
{
Console.WriteLine($"Database initialization failed: {ex.Message}");
}
}
protected override Window CreateWindow(IActivationState? activationState)
{
return new Window(new AppShell());
}
}
6 months ago
}