Skip to content

Instantly share code, notes, and snippets.

@icebeam7
Created December 5, 2019 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icebeam7/2bf18114e6399cf420ecf558524fd185 to your computer and use it in GitHub Desktop.
Save icebeam7/2bf18114e6399cf420ecf558524fd185 to your computer and use it in GitHub Desktop.
HarryPotterApp: App.xaml.cs
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