-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
36 lines (32 loc) · 957 Bytes
/
App.xaml.cs
File metadata and controls
36 lines (32 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using HamStudyX.Services;
using System.IO;
namespace HamStudyX
{
public partial class App : Application
{
// Sing intance of db service
static DatabaseService? _database;
/// <summary>
/// Access to db service instance.
/// Init if not already.
/// </summary>
public static DatabaseService Database
{
get
{
if (_database == null)
{
// Construct db path by combining db path with local app data folder.
var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "QuizHistory.db3");
_database = new DatabaseService(dbPath);
}
return _database;
}
}
public App()
{
InitializeComponent();
MainPage = new AppShell();
}
}
}