Created
December 5, 2019 00:36
-
-
Save icebeam7/2bf18114e6399cf420ecf558524fd185 to your computer and use it in GitHub Desktop.
HarryPotterApp: App.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using Xamarin.Forms; | |
using HarryPotterApp.Data; | |
namespace HarryPotterApp | |
{ | |
public partial class App : Application | |
{ | |
private static DatabaseContext context; | |
public static DatabaseContext Context | |
{ | |
get | |
{ | |
if (context == null) | |
{ | |
var dbPath = Path.Combine( | |
Environment.GetFolderPath( | |
Environment.SpecialFolder.LocalApplicationData), | |
"HarryPotterDB.db3"); | |
context = new DatabaseContext(dbPath); | |
} | |
return context; | |
} | |
} | |
public App() | |
{ | |
InitializeComponent(); | |
MainPage = new NavigationPage(new Views.CharactersListView()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment