This file contains hidden or 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; | |
| namespace SQLiteExample { | |
| public enum Gender { | |
| Male, | |
| Female | |
| } | |
| public class Person : BaseItem { | |
| public string FirstName { get; set; } | |
| public string LastName { get; set; } |
This file contains hidden or 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.Collections.Generic; | |
| using System.Linq; | |
| using SQLite; | |
| using Xamarin.Forms; | |
| namespace SQLiteExample { | |
| public class Database { | |
| static object locker = new object(); | |
| ISQLiteService SQLite { |
This file contains hidden or 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 SQLite; | |
| namespace SQLiteExample { | |
| public class BaseItem { | |
| [PrimaryKey, AutoIncrement] | |
| public int ID { get; set; } | |
| } | |
| } | |
This file contains hidden or 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 SQLite; | |
| using Xamarin.Forms; | |
| [assembly: Dependency(typeof(SQLiteExample.Droid.SQLiteService))] | |
| namespace SQLiteExample.Droid { | |
| public class SQLiteService : ISQLiteService { | |
| string GetPath(string databaseName) { | |
| if (string.IsNullOrWhiteSpace(databaseName)) { |
This file contains hidden or 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 SQLite; | |
| using Xamarin.Forms; | |
| [assembly: Dependency(typeof(SQLiteExample.iOS.SQLiteService))] | |
| namespace SQLiteExample.iOS { | |
| public class SQLiteService : ISQLiteService { | |
| string GetPath(string databaseName) { | |
| if (string.IsNullOrWhiteSpace(databaseName)) { |
This file contains hidden or 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 SQLite; | |
| namespace SQLiteExample { | |
| public interface ISQLiteService { | |
| SQLiteConnection GetConnection(string databaseName); | |
| long GetSize(string databaseName); | |
| } | |
| } |
This file contains hidden or 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
| public partial class App : Application { | |
| public NavigationPage NavigationPage { get; private set; } | |
| public App() { | |
| var menuPage = new MenuPage(); | |
| NavigationPage = new NavigationPage(new HomePage()); | |
| var rootPage = new RootPage(); | |
| rootPage.Master = menuPage; | |
| rootPage.Detail = NavigationPage; | |
| MainPage = rootPage; |
This file contains hidden or 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
| public partial class RootPage : MasterDetailPage { | |
| public RootPage() { | |
| InitializeComponent(); | |
| MasterBehavior = MasterBehavior.Popover; | |
| } | |
| } |
This file contains hidden or 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
| public partial class HomePage : ContentPage { | |
| public HomePage() { | |
| InitializeComponent(); | |
| // Add your UI code here or in your XAML file | |
| } | |
| } |