d85f2e0fb3
Bootstraper läd jetzt die farbeinstellung sofort und nicht nachträglich cleanup and rework PDF switch to HTML export fix Colorsystem Farben für knöpfe hinzugefügt als anpassung button color button color primary and secondary change
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using Microsoft.Maui.Storage;
|
|
|
|
namespace cfs_tracker.Services;
|
|
|
|
public class DatabaseLocationService
|
|
{
|
|
private const string UseExternalDatabaseKey = "db_use_external";
|
|
private const string ExternalDatabasePathKey = "db_external_path";
|
|
|
|
public bool UseExternalDatabase
|
|
{
|
|
get => Preferences.Default.Get(UseExternalDatabaseKey, false);
|
|
set => Preferences.Default.Set(UseExternalDatabaseKey, value);
|
|
}
|
|
|
|
public string ExternalDatabasePath
|
|
{
|
|
get => Preferences.Default.Get(ExternalDatabasePathKey, string.Empty);
|
|
set => Preferences.Default.Set(ExternalDatabasePathKey, value ?? string.Empty);
|
|
}
|
|
|
|
public string ResolveDatabasePath()
|
|
{
|
|
if (UseExternalDatabase)
|
|
{
|
|
var configured = (ExternalDatabasePath ?? string.Empty).Trim();
|
|
if (!string.IsNullOrWhiteSpace(configured))
|
|
{
|
|
if (Path.HasExtension(configured))
|
|
return configured;
|
|
|
|
return Path.Combine(configured, "cfs_tracker.db3");
|
|
}
|
|
}
|
|
|
|
return Path.Combine(FileSystem.Current.AppDataDirectory, "cfs_tracker.db3");
|
|
}
|
|
}
|