2b0797f50f
Linked colors to options menu Options extension Aussehen aufgebohrt: - erlaubt text von status zu ändern, - bessere beschriftung von Farben desing änderung und bedienung - heute status felder anklickbar, - Farbpalette verdunkelt und kontrast reduziert - Kalender Tage anklickbar gemacht - Optionen überarbeitet
31 lines
953 B
C#
31 lines
953 B
C#
using SQLite;
|
|
using cfs_tracker.Models;
|
|
using Microsoft.Maui.Storage;
|
|
|
|
namespace cfs_tracker.Data;
|
|
|
|
public class AppDatabase
|
|
{
|
|
private SQLiteAsyncConnection? _database;
|
|
private bool _initialized;
|
|
|
|
public async Task InitAsync()
|
|
{
|
|
if (_initialized) return;
|
|
|
|
var dbPath = Path.Combine(FileSystem.Current.AppDataDirectory, "cfs_tracker.db3");
|
|
_database = new SQLiteAsyncConnection(dbPath);
|
|
|
|
await _database.CreateTableAsync<ActivityItem>();
|
|
await _database.CreateTableAsync<SymptomItem>();
|
|
await _database.CreateTableAsync<HealthEntry>();
|
|
await _database.CreateTableAsync<HealthEntrySymptom>();
|
|
await _database.CreateTableAsync<ThemeSettingItem>();
|
|
await _database.CreateTableAsync<AppearanceSetting>();
|
|
|
|
_initialized = true;
|
|
}
|
|
|
|
public SQLiteAsyncConnection Connection => _database ?? throw new InvalidOperationException("Database not initialized.");
|
|
}
|